Add custom.ini
This commit is contained in:
parent
52837e3d36
commit
6ce9d800d0
4 changed files with 14 additions and 18 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/Unknwon/goconfig"
|
||||
)
|
||||
|
||||
|
@ -36,11 +37,20 @@ func init() {
|
|||
os.Exit(2)
|
||||
}
|
||||
|
||||
cfgPath := filepath.Join(workDir, "conf", "app.ini")
|
||||
cfgPathPrefix := filepath.Join(workDir, "conf")
|
||||
cfgPath := filepath.Join(cfgPathPrefix, "app.ini")
|
||||
Cfg, err = goconfig.LoadConfigFile(cfgPath)
|
||||
if err != nil {
|
||||
fmt.Printf("Cannot load config file '%s'\n", cfgPath)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
cfgPath = filepath.Join(cfgPathPrefix, "custom.ini")
|
||||
if com.IsFile(cfgPath) {
|
||||
if err = Cfg.AppendFiles(cfgPath); err != nil {
|
||||
fmt.Printf("Cannot load config file '%s'\n", cfgPath)
|
||||
os.Exit(2)
|
||||
}
|
||||
}
|
||||
Cfg.BlockMode = false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue