Default to YAML when config file has no extension (#2618)

This commit is contained in:
R. Franco 2022-02-24 20:01:11 +00:00 committed by GitHub
parent 1bf82059f1
commit ea1df6f164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,11 @@ func (r *FileReader) Read() error {
if configFile != "" {
viper.SetConfigFile(configFile)
// Assume YAML if the file has no extension.
if filepath.Ext(configFile) == "" {
viper.SetConfigType("yaml")
}
} else {
r.setupConfigFileSearch()
}