aboutsummaryrefslogtreecommitdiff
path: root/modules/base/conf.go
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-25 19:39:57 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-25 19:39:57 +0800
commit9b7e2823ead36c90e656ce76fcbb464f7a490363 (patch)
tree201fdf621b9d1a5f3e954529e4e5d8e2f9429ac0 /modules/base/conf.go
parent5d67960b1e812c2b455c93ec9c86d72c9c9a7f5b (diff)
parentca49acfe67cee4b5d4be40519b83d9107833e60d (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r--modules/base/conf.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 90b35476..1661681e 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,16 @@ 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 len(curUser) == 0 {
+ curUser = os.Getenv("USER")
+ }
+ 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)