mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix #1436
This commit is contained in:
		@@ -64,6 +64,7 @@ var (
 | 
			
		||||
	StartSSHServer     bool
 | 
			
		||||
	SSHDomain          string
 | 
			
		||||
	SSHPort            int
 | 
			
		||||
	SSHRootPath        string
 | 
			
		||||
	OfflineMode        bool
 | 
			
		||||
	DisableRouterLog   bool
 | 
			
		||||
	CertFile, KeyFile  string
 | 
			
		||||
@@ -273,10 +274,16 @@ func NewContext() {
 | 
			
		||||
			log.Fatal(4, "Fail to load custom conf '%s': %v", CustomConf, err)
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		log.Warn("Custom config (%s) not found, ignore this if you're running first time", CustomConf)
 | 
			
		||||
		log.Warn("Custom config '%s' not found, ignore this if you're running first time", CustomConf)
 | 
			
		||||
	}
 | 
			
		||||
	Cfg.NameMapper = ini.AllCapsUnderscore
 | 
			
		||||
 | 
			
		||||
	homeDir, err := com.HomeDir()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(4, "Fail to get home directory: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	homeDir = strings.Replace(homeDir, "\\", "/", -1)
 | 
			
		||||
 | 
			
		||||
	LogRootPath = Cfg.Section("log").Key("ROOT_PATH").MustString(path.Join(workDir, "log"))
 | 
			
		||||
	forcePathSeparator(LogRootPath)
 | 
			
		||||
 | 
			
		||||
@@ -290,7 +297,7 @@ func NewContext() {
 | 
			
		||||
	// Check if has app suburl.
 | 
			
		||||
	url, err := url.Parse(AppUrl)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(4, "Invalid ROOT_URL(%s): %s", AppUrl, err)
 | 
			
		||||
		log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err)
 | 
			
		||||
	}
 | 
			
		||||
	AppSubUrl = strings.TrimSuffix(url.Path, "/")
 | 
			
		||||
 | 
			
		||||
@@ -312,6 +319,10 @@ func NewContext() {
 | 
			
		||||
	}
 | 
			
		||||
	SSHDomain = sec.Key("SSH_DOMAIN").MustString(Domain)
 | 
			
		||||
	SSHPort = sec.Key("SSH_PORT").MustInt(22)
 | 
			
		||||
	SSHRootPath = sec.Key("SSH_ROOT_PATH").MustString(path.Join(homeDir, ".ssh"))
 | 
			
		||||
	if err := os.MkdirAll(SSHRootPath, 0700); err != nil {
 | 
			
		||||
		log.Fatal(4, "Fail to create '%s': %v", SSHRootPath, err)
 | 
			
		||||
	}
 | 
			
		||||
	OfflineMode = sec.Key("OFFLINE_MODE").MustBool()
 | 
			
		||||
	DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool()
 | 
			
		||||
	StaticRootPath = sec.Key("STATIC_ROOT_PATH").MustString(workDir)
 | 
			
		||||
@@ -368,12 +379,6 @@ func NewContext() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Determine and create root git repository path.
 | 
			
		||||
	homeDir, err := com.HomeDir()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(4, "Fail to get home directory: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	homeDir = strings.Replace(homeDir, "\\", "/", -1)
 | 
			
		||||
 | 
			
		||||
	sec = Cfg.Section("repository")
 | 
			
		||||
	RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gogs-repositories"))
 | 
			
		||||
	forcePathSeparator(RepoRootPath)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user