mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
config: add configDir before additional search paths
This way the configuration will be searched in the following order: - config dir - $HOME/.config/sftpgo - /etc/sftpgo - current directory
This commit is contained in:
parent
795ffc4c5f
commit
53d70b68d8
1 changed files with 2 additions and 2 deletions
|
@ -83,8 +83,6 @@ func init() {
|
|||
replacer := strings.NewReplacer(".", "__")
|
||||
viper.SetEnvKeyReplacer(replacer)
|
||||
viper.SetConfigName(DefaultConfigName)
|
||||
setViperAdditionalConfigPaths()
|
||||
viper.AddConfigPath(".")
|
||||
viper.AutomaticEnv()
|
||||
viper.AllowEmptyEnv(true)
|
||||
}
|
||||
|
@ -112,6 +110,8 @@ func GetProviderConf() dataprovider.Config {
|
|||
func LoadConfig(configDir, configName string) error {
|
||||
var err error
|
||||
viper.AddConfigPath(configDir)
|
||||
setViperAdditionalConfigPaths()
|
||||
viper.AddConfigPath(".")
|
||||
viper.SetConfigName(configName)
|
||||
if err = viper.ReadInConfig(); err != nil {
|
||||
logger.Warn(logSender, "error loading configuration file: %v. Default configuration will be used: %+v", err, globalConf)
|
||||
|
|
Loading…
Reference in a new issue