[#1115] neofs-ir: determine config type based on extension
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
c1530dec5e
commit
18f6fba6ea
1 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,11 @@ func newConfig(path string) (*viper.Viper, error) {
|
||||||
|
|
||||||
if path != "" {
|
if path != "" {
|
||||||
v.SetConfigFile(path)
|
v.SetConfigFile(path)
|
||||||
v.SetConfigType("yml") // fixme: for now
|
if strings.HasSuffix(path, ".json") {
|
||||||
|
v.SetConfigType("json")
|
||||||
|
} else {
|
||||||
|
v.SetConfigType("yml")
|
||||||
|
}
|
||||||
err = v.ReadInConfig()
|
err = v.ReadInConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue