mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 12:00:01 +02:00
Add option to provide configuration file on command line
This commit is contained in:
parent
02c5bade0f
commit
1ab09e4f1b
8 changed files with 37 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue