diff options
author | Peter Smit <peter@smitmail.eu> | 2015-02-05 12:12:37 +0200 |
---|---|---|
committer | Peter Smit <peter@smitmail.eu> | 2015-02-05 12:17:35 +0200 |
commit | 1ab09e4f1b27789121dfba9a6c6e4aa0011ab215 (patch) | |
tree | 59ec5e54ed44c41915217522ea37bebf24bd5797 /modules/setting | |
parent | 02c5bade0fabc24b9b7c05a74c65965e2e53f687 (diff) | |
download | gitea-1ab09e4f1b27789121dfba9a6c6e4aa0011ab215.tar.gz gitea-1ab09e4f1b27789121dfba9a6c6e4aa0011ab215.zip |
Add option to provide configuration file on command line
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/setting.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index e7c44cdd4f..79aaf7a064 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -124,6 +124,7 @@ var ( Cfg *ini.File ConfRootPath string CustomPath string // Custom directory path. + CustomConf string ProdMode bool RunUser string IsWindows bool @@ -172,13 +173,16 @@ func NewConfigContext() { CustomPath = path.Join(workDir, "custom") } - cfgPath := path.Join(CustomPath, "conf/app.ini") - if com.IsFile(cfgPath) { - if err = Cfg.Append(cfgPath); err != nil { - log.Fatal(4, "Fail to load custom 'conf/app.ini': %v", err) + if len(CustomConf) == 0 { + CustomConf = path.Join(CustomPath, "conf/app.ini") + } + + if com.IsFile(CustomConf) { + if err = Cfg.Append(CustomConf); err != nil { + log.Fatal(4, "Fail to load custom conf '%s': %v", CustomConf, err) } } else { - log.Warn("No custom 'conf/app.ini' found, ignore this if you're running first time") + log.Warn("Custom config (%s) not found, ignore this if you're running first time", CustomConf) } Cfg.NameMapper = ini.AllCapsUnderscore |