[#1115] neofs-ir: determine config type based on extension

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-02-07 18:41:07 +03:00 committed by Alex Vanin
parent c1530dec5e
commit 18f6fba6ea

View file

@ -23,7 +23,11 @@ func newConfig(path string) (*viper.Viper, error) {
if 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()
}