Skip to content

Commit 97d0e47

Browse files
committed
When config file isn't found, this shouldn't be fatal
new installs wont have this before they add contexts.
1 parent f845694 commit 97d0e47

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/core.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ func InitConfig() (vp *viper.Viper, err error) {
3434
}
3535

3636
vp.AutomaticEnv()
37-
if err := vp.ReadInConfig(); err != nil {
38-
utils.PrintYellow("no config\n")
37+
if err = vp.ReadInConfig(); err != nil {
38+
if _, notFound := err.(viper.ConfigFileNotFoundError); notFound {
39+
err = nil
40+
return
41+
}
42+
utils.PrintYellow("error reading config: %s\n", err)
43+
return
3944
}
4045

4146
if UseContextArg != "" {

0 commit comments

Comments
 (0)