Add UseCompatSSHURI setting (#2356)
* Add UseCompatSSHURI setting Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com> (+1 squashed commits) Squashed commits: [dda2dc79] Add ForceCloneSSHURL setting Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com> * Make protocol if construct more readable Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com>
This commit is contained in:
parent
f61a1d210c
commit
d9d8fad230
3 changed files with 8 additions and 0 deletions
2
conf/app.ini
vendored
2
conf/app.ini
vendored
|
@ -23,6 +23,8 @@ PULL_REQUEST_QUEUE_LENGTH = 1000
|
||||||
PREFERRED_LICENSES = Apache License 2.0,MIT License
|
PREFERRED_LICENSES = Apache License 2.0,MIT License
|
||||||
; Disable ability to interact with repositories by HTTP protocol
|
; Disable ability to interact with repositories by HTTP protocol
|
||||||
DISABLE_HTTP_GIT = false
|
DISABLE_HTTP_GIT = false
|
||||||
|
; Force ssh:// clone url instead of scp-style uri when default SSH port is used
|
||||||
|
USE_COMPAT_SSH_URI = false
|
||||||
|
|
||||||
[repository.editor]
|
[repository.editor]
|
||||||
; List of file extensions that should have line wraps in the CodeMirror editor
|
; List of file extensions that should have line wraps in the CodeMirror editor
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -791,6 +792,8 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
|
||||||
cl := new(CloneLink)
|
cl := new(CloneLink)
|
||||||
if setting.SSH.Port != 22 {
|
if setting.SSH.Port != 22 {
|
||||||
cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName)
|
cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName)
|
||||||
|
} else if setting.Repository.UseCompatSSHURI {
|
||||||
|
cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
|
||||||
} else {
|
} else {
|
||||||
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
|
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ var (
|
||||||
PullRequestQueueLength int
|
PullRequestQueueLength int
|
||||||
PreferredLicenses []string
|
PreferredLicenses []string
|
||||||
DisableHTTPGit bool
|
DisableHTTPGit bool
|
||||||
|
UseCompatSSHURI bool
|
||||||
|
|
||||||
// Repository editor settings
|
// Repository editor settings
|
||||||
Editor struct {
|
Editor struct {
|
||||||
|
@ -189,6 +190,7 @@ var (
|
||||||
PullRequestQueueLength: 1000,
|
PullRequestQueueLength: 1000,
|
||||||
PreferredLicenses: []string{"Apache License 2.0,MIT License"},
|
PreferredLicenses: []string{"Apache License 2.0,MIT License"},
|
||||||
DisableHTTPGit: false,
|
DisableHTTPGit: false,
|
||||||
|
UseCompatSSHURI: false,
|
||||||
|
|
||||||
// Repository editor settings
|
// Repository editor settings
|
||||||
Editor: struct {
|
Editor: struct {
|
||||||
|
@ -903,6 +905,7 @@ func NewContext() {
|
||||||
// Determine and create root git repository path.
|
// Determine and create root git repository path.
|
||||||
sec = Cfg.Section("repository")
|
sec = Cfg.Section("repository")
|
||||||
Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool()
|
Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool()
|
||||||
|
Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool()
|
||||||
Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1)
|
Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1)
|
||||||
RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gitea-repositories"))
|
RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gitea-repositories"))
|
||||||
forcePathSeparator(RepoRootPath)
|
forcePathSeparator(RepoRootPath)
|
||||||
|
|
Loading…
Reference in a new issue