Skip to content

Commit 1a77872

Browse files
committed
Config: abort on parse errors
Don't log warnings when no config file is found: this is a normal situation, the configuration file isn't requiered in any way. But if a configuration file is provided, it should parse without errors.
1 parent 4405b50 commit 1a77872

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/configfile.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"log"
45
"os"
56
"strings"
67

@@ -31,6 +32,9 @@ func loadConfigFile() {
3132
viper.AutomaticEnv()
3233

3334
if err := viper.ReadInConfig(); err != nil {
34-
RootCmd.Printf("Can't read config file: %v\n", err)
35+
_, ok := err.(viper.ConfigParseError)
36+
if ok {
37+
log.Fatalf("Can't read config file: %v\n", err)
38+
}
3539
}
3640
}

0 commit comments

Comments
 (0)