aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorClar Fon <usr@ltdk.xyz>2022-02-07 16:56:45 -0500
committerGitHub <noreply@github.com>2022-02-07 16:56:45 -0500
commit99d14f6051854fe0e6dfc7fb6f4eb0a839179977 (patch)
tree746cd4e72854e696c87f017c9238f510f826879b /models
parent9911b66aea076347cfb271b12c90bc31e4e5b5f8 (diff)
downloadgitea-99d14f6051854fe0e6dfc7fb6f4eb0a839179977.tar.gz
gitea-99d14f6051854fe0e6dfc7fb6f4eb0a839179977.zip
Add separate SSH_USER config option (#17584)
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r--models/repo/repo.go5
-rw-r--r--models/repo/wiki_test.go2
-rw-r--r--models/unittest/testdb.go2
3 files changed, 4 insertions, 5 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go
index 353d707e60..28d976773d 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -540,10 +540,7 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
repoName += ".wiki"
}
- sshUser := setting.RunUser
- if setting.SSH.StartBuiltinServer {
- sshUser = setting.SSH.BuiltinServerUser
- }
+ sshUser := setting.SSH.User
cl := new(CloneLink)
diff --git a/models/repo/wiki_test.go b/models/repo/wiki_test.go
index 72f5280ce5..f5e61e5ae3 100644
--- a/models/repo/wiki_test.go
+++ b/models/repo/wiki_test.go
@@ -19,7 +19,7 @@ func TestRepository_WikiCloneLink(t *testing.T) {
repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
cloneLink := repo.WikiCloneLink()
- assert.Equal(t, "ssh://runuser@try.gitea.io:3000/user2/repo1.wiki.git", cloneLink.SSH)
+ assert.Equal(t, "ssh://sshuser@try.gitea.io:3000/user2/repo1.wiki.git", cloneLink.SSH)
assert.Equal(t, "https://try.gitea.io/user2/repo1.wiki.git", cloneLink.HTTPS)
}
diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go
index c904646d28..80dcb428df 100644
--- a/models/unittest/testdb.go
+++ b/models/unittest/testdb.go
@@ -64,6 +64,8 @@ func MainTest(m *testing.M, pathToGiteaRoot string, fixtureFiles ...string) {
setting.AppURL = "https://try.gitea.io/"
setting.RunUser = "runuser"
+ setting.SSH.User = "sshuser"
+ setting.SSH.BuiltinServerUser = "builtinuser"
setting.SSH.Port = 3000
setting.SSH.Domain = "try.gitea.io"
setting.Database.UseSQLite3 = true