Skip to content

Commit b8498d7

Browse files
authored
fix: only error if config is directly provided (#52)
* fix: only error if config is directly provided * simplify
1 parent 1782442 commit b8498d7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/ctrlc/ctrlc.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ func initConfig() {
6262
}
6363

6464
if err := viper.ReadInConfig(); err != nil {
65-
log.Error("Can't read config", "error", err)
66-
os.Exit(1)
65+
if cfgFile != "" {
66+
log.Error("Can't read config", "error", err)
67+
os.Exit(1)
68+
} else {
69+
log.Warn("Can't read config", "error", err)
70+
}
6771
}
6872
}

0 commit comments

Comments
 (0)