summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-02-08 20:22:02 -0500
committer无闻 <u@gogs.io>2015-02-08 20:22:02 -0500
commitcd0ee35b3f887cc4ab6ba16cc2d955bfae607678 (patch)
treebbe4ad9e924700d35833daf4f681a568dad278f5 /modules
parent3a44143b81aa050f53d5e0e2c87d4a84345cd94e (diff)
parent1ab09e4f1b27789121dfba9a6c6e4aa0011ab215 (diff)
downloadgitea-cd0ee35b3f887cc4ab6ba16cc2d955bfae607678.tar.gz
gitea-cd0ee35b3f887cc4ab6ba16cc2d955bfae607678.zip
Merge pull request #905 from phsmit/conf_on_cli
Add option to provide configuration file on command line
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 6a205921b8..f5212a2867 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -125,6 +125,7 @@ var (
Cfg *ini.File
ConfRootPath string
CustomPath string // Custom directory path.
+ CustomConf string
ProdMode bool
RunUser string
IsWindows bool
@@ -173,13 +174,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