summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-11 11:18:10 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-11 11:18:10 -0400
commitfd4b123e88e8a106dc0f43db9e9d59c877b2d799 (patch)
tree34f8ea59806ef03606b7276d51457ac7f1a8375d /modules
parentd122aa6d888a3512cbc00f521b01f61667fa0a95 (diff)
downloadgitea-fd4b123e88e8a106dc0f43db9e9d59c877b2d799.tar.gz
gitea-fd4b123e88e8a106dc0f43db9e9d59c877b2d799.zip
Fix #94 and fix #169
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go2
-rw-r--r--modules/middleware/repo.go6
2 files changed, 7 insertions, 1 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 88085172c2..99bac9006f 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -49,6 +49,7 @@ var (
AppName string
AppLogo string
AppUrl string
+ SshPort int
OfflineMode bool
DisableRouterLog bool
ProdMode bool
@@ -330,6 +331,7 @@ func NewConfigContext() {
AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png")
AppUrl = Cfg.MustValue("server", "ROOT_URL")
Domain = Cfg.MustValue("server", "DOMAIN")
+ SshPort = Cfg.MustInt("server", "SSH_PORT", 22)
OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE", false)
DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG", false)
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 4a10edf881..1516482167 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -153,7 +153,11 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner
ctx.Data["BranchName"] = ""
- ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
+ sshPrefix := ""
+ if base.SshPort != 22 {
+ sshPrefix = "ssh://"
+ }
+ ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s%s@%s:%s/%s.git", sshPrefix, base.RunUser, base.Domain, user.LowerName, repo.LowerName)
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", base.AppUrl, user.LowerName, repo.LowerName)
ctx.Data["CloneLink"] = ctx.Repo.CloneLink