Browse Source

Add new config option for builtin SSH server

Config option [server] SSH_LISTEN_PORT to the port the builtin SSH server will be listen.
It can be different from SSH_PORT which is supposed to be exposed in the clone URL.
This should solve the problem when user runs Gogs inside Docker container
and still want to use builtin SSH server.
Unknwon 9 years ago
parent
commit
4438b7793b
6 changed files with 12 additions and 5 deletions
  1. 6 1
      conf/app.ini
  2. 1 1
      gogs.go
  3. 0 0
      modules/bindata/bindata.go
  4. 2 0
      modules/setting/setting.go
  5. 2 2
      routers/install.go
  6. 1 1
      templates/.VERSION

+ 6 - 1
conf/app.ini

@@ -63,8 +63,13 @@ LOCAL_ROOT_URL = http://localhost:%(HTTP_PORT)s/
 DISABLE_SSH = false
 DISABLE_SSH = false
 ; Whether use builtin SSH server or not.
 ; Whether use builtin SSH server or not.
 START_SSH_SERVER = false
 START_SSH_SERVER = false
+; Domain name to be exposed in clone URL
+SSH_DOMAIN = %(DOMAIN)s
+; Port number to be exposed in clone URL
 SSH_PORT = 22
 SSH_PORT = 22
-; Root path of SSH directory
+; Port number builtin SSH server listens on
+SSH_LISTEN_PORT = %(SSH_PORT)s
+; Root path of SSH directory, default is '~/.ssh', but you have to use '/home/git/.ssh'.
 SSH_ROOT_PATH = 
 SSH_ROOT_PATH = 
 ; Disable CDN even in "prod" mode
 ; Disable CDN even in "prod" mode
 OFFLINE_MODE = false
 OFFLINE_MODE = false

+ 1 - 1
gogs.go

@@ -17,7 +17,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 	"github.com/gogits/gogs/modules/setting"
 )
 )
 
 
-const APP_VER = "0.8.44.0224"
+const APP_VER = "0.8.44.0225"
 
 
 func init() {
 func init() {
 	runtime.GOMAXPROCS(runtime.NumCPU())
 	runtime.GOMAXPROCS(runtime.NumCPU())

File diff suppressed because it is too large
+ 0 - 0
modules/bindata/bindata.go


+ 2 - 0
modules/setting/setting.go

@@ -65,6 +65,7 @@ var (
 	StartSSHServer     bool
 	StartSSHServer     bool
 	SSHDomain          string
 	SSHDomain          string
 	SSHPort            int
 	SSHPort            int
+	SSHListenPort      int
 	SSHRootPath        string
 	SSHRootPath        string
 	OfflineMode        bool
 	OfflineMode        bool
 	DisableRouterLog   bool
 	DisableRouterLog   bool
@@ -324,6 +325,7 @@ func NewContext() {
 	}
 	}
 	SSHDomain = sec.Key("SSH_DOMAIN").MustString(Domain)
 	SSHDomain = sec.Key("SSH_DOMAIN").MustString(Domain)
 	SSHPort = sec.Key("SSH_PORT").MustInt(22)
 	SSHPort = sec.Key("SSH_PORT").MustInt(22)
+	SSHListenPort = sec.Key("SSH_LISTEN_PORT").MustInt(SSHPort)
 	SSHRootPath = sec.Key("SSH_ROOT_PATH").MustString(path.Join(homeDir, ".ssh"))
 	SSHRootPath = sec.Key("SSH_ROOT_PATH").MustString(path.Join(homeDir, ".ssh"))
 	if err := os.MkdirAll(SSHRootPath, 0700); err != nil {
 	if err := os.MkdirAll(SSHRootPath, 0700); err != nil {
 		log.Fatal(4, "Fail to create '%s': %v", SSHRootPath, err)
 		log.Fatal(4, "Fail to create '%s': %v", SSHRootPath, err)

+ 2 - 2
routers/install.go

@@ -89,8 +89,8 @@ func GlobalInit() {
 	checkRunMode()
 	checkRunMode()
 
 
 	if setting.StartSSHServer {
 	if setting.StartSSHServer {
-		ssh.Listen(setting.SSHPort)
-		log.Info("SSH server started on :%v", setting.SSHPort)
+		ssh.Listen(setting.SSHListenPort)
+		log.Info("SSH server started on :%v", setting.SSHListenPort)
 	}
 	}
 
 
 	// Build Sanitizer
 	// Build Sanitizer

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.8.44.0224
+0.8.44.0225

Some files were not shown because too many files changed in this diff