Skip to content

Commit a7f46b7

Browse files
b0bbywanclaude
andcommitted
fail hard on invalid config file instead of warning and using defaults
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent acefe2d commit a7f46b7

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

config/config.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,8 @@ func New(cfgFile *string) (*Config, error) {
303303
viper.SetConfigType("yaml") // config file format
304304

305305
if err := readConfig(cfgFile); err != nil {
306-
// If user explicitly provided a config file, fail hard on any error
307-
if cfgFile != nil && *cfgFile != "" {
308-
return nil, fmt.Errorf("failed to read config file: %w", err)
309-
}
310-
// Otherwise, only warn for non-file-not-found errors
311306
if _, isNotFound := err.(viper.ConfigFileNotFoundError); !isNotFound {
312-
logger.Warn("failed to read config: %v", err)
307+
return nil, fmt.Errorf("failed to read config file: %w", err)
313308
}
314309
}
315310

0 commit comments

Comments
 (0)