Skip to content

Commit 304281e

Browse files
fix(config): No longer crashes on startup when config file doesn't exist, just warns user
1 parent d723498 commit 304281e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ func initConfig() {
8080

8181
// If a config file is found, read it in.
8282
if err := viper.ReadInConfig(); err != nil {
83-
logger.Errorf("Unable read from config: %s", err)
84-
os.Exit(1)
83+
// Non-blocking, because some command does not require config file, ie: docgen.
84+
logger.Warnf("Unable read from config: %s", err)
85+
return
8586
}
8687
logger.Infof("Using config file: %s", viper.ConfigFileUsed())
8788
}

0 commit comments

Comments
 (0)