Browse Source

Fix #94 and fix #169

pull/175/head
Unknown 11 years ago
parent
commit
fd4b123e88
  1. 1
      conf/app.ini
  2. 2
      modules/base/conf.go
  3. 6
      modules/middleware/repo.go

1
conf/app.ini

@ -18,6 +18,7 @@ DOMAIN = localhost
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/ ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
HTTP_ADDR = HTTP_ADDR =
HTTP_PORT = 3000 HTTP_PORT = 3000
SSH_PORT = 22
; Disable CDN even in "prod" mode ; Disable CDN even in "prod" mode
OFFLINE_MODE = false OFFLINE_MODE = false
DISABLE_ROUTER_LOG = false DISABLE_ROUTER_LOG = false

2
modules/base/conf.go

@ -49,6 +49,7 @@ var (
AppName string AppName string
AppLogo string AppLogo string
AppUrl string AppUrl string
SshPort int
OfflineMode bool OfflineMode bool
DisableRouterLog bool DisableRouterLog bool
ProdMode bool ProdMode bool
@ -330,6 +331,7 @@ func NewConfigContext() {
AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png") AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png")
AppUrl = Cfg.MustValue("server", "ROOT_URL") AppUrl = Cfg.MustValue("server", "ROOT_URL")
Domain = Cfg.MustValue("server", "DOMAIN") Domain = Cfg.MustValue("server", "DOMAIN")
SshPort = Cfg.MustInt("server", "SSH_PORT", 22)
OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE", false) OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE", false)
DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG", false) DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG", false)
SecretKey = Cfg.MustValue("security", "SECRET_KEY") SecretKey = Cfg.MustValue("security", "SECRET_KEY")

6
modules/middleware/repo.go

@ -153,7 +153,11 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner
ctx.Data["BranchName"] = "" 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.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", base.AppUrl, user.LowerName, repo.LowerName)
ctx.Data["CloneLink"] = ctx.Repo.CloneLink ctx.Data["CloneLink"] = ctx.Repo.CloneLink

Loading…
Cancel
Save