summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-25 06:52:56 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-25 06:52:56 -0400
commiteeb793524f2da4afdca017b585d9cfb6e9628e85 (patch)
treebb991219822ee3e4327939d92986f6f7f00196da /modules
parent6ef3e8b3c9a085e3d99b02ba7bb80fc8126f2f90 (diff)
downloadgitea-eeb793524f2da4afdca017b585d9cfb6e9628e85.tar.gz
gitea-eeb793524f2da4afdca017b585d9cfb6e9628e85.zip
Check run user
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index d3122a5339..c692ddc23f 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -259,16 +259,11 @@ func NewConfigContext() {
Cfg.BlockMode = false
cfgPath = filepath.Join(workDir, "custom/conf/app.ini")
- if !com.IsFile(cfgPath) {
- fmt.Println("Custom configuration not found(custom/conf/app.ini)\n" +
- "Please create it and make your own configuration!")
- os.Exit(2)
-
- }
-
- if err = Cfg.AppendFiles(cfgPath); err != nil {
- fmt.Printf("Cannot load config file '%s'\n", cfgPath)
- os.Exit(2)
+ if com.IsFile(cfgPath) {
+ if err = Cfg.AppendFiles(cfgPath); err != nil {
+ fmt.Printf("Cannot load config file '%s'\n", cfgPath)
+ os.Exit(2)
+ }
}
AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service")
@@ -276,7 +271,13 @@ func NewConfigContext() {
AppUrl = Cfg.MustValue("server", "ROOT_URL")
Domain = Cfg.MustValue("server", "DOMAIN")
SecretKey = Cfg.MustValue("security", "SECRET_KEY")
+
RunUser = Cfg.MustValue("", "RUN_USER")
+ curUser := os.Getenv("USERNAME")
+ if RunUser != curUser {
+ fmt.Printf("Expect user(%s) but current user is: %s\n", RunUser, curUser)
+ os.Exit(2)
+ }
EnableHttpsClone = Cfg.MustBool("security", "ENABLE_HTTPS_CLONE", false)