forked from TrueCloudLab/frostfs-node
[#44] ir: Support multiple configs
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
87e69b9349
commit
bed5a36235
2 changed files with 11 additions and 3 deletions
|
@ -4,10 +4,11 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/TrueCloudLab/frostfs-node/pkg/util/config"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func newConfig(path string) (*viper.Viper, error) {
|
||||
func newConfig(path, directory string) (*viper.Viper, error) {
|
||||
const envPrefix = "FROSTFS_IR"
|
||||
|
||||
var (
|
||||
|
@ -28,7 +29,13 @@ func newConfig(path string) (*viper.Viper, error) {
|
|||
} else {
|
||||
v.SetConfigType("yml")
|
||||
}
|
||||
err = v.ReadInConfig()
|
||||
if err = v.ReadInConfig(); err != nil {
|
||||
return v, err
|
||||
}
|
||||
}
|
||||
|
||||
if directory != "" {
|
||||
err = config.ReadConfigDir(v, directory)
|
||||
}
|
||||
|
||||
return v, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue