don't crash if config file is missing (#2656)

This commit is contained in:
Stavros Kois
2025-07-04 15:58:17 +03:00
committed by GitHub
parent 3bad5d5590
commit ded049b905
2 changed files with 6 additions and 0 deletions

View File

@@ -335,6 +335,10 @@ func LoadConfig(path string, isFile bool) error {
viper.SetDefault("prefixes.allocation", string(IPAllocationStrategySequential))
if err := viper.ReadInConfig(); err != nil {
if errors.Is(err, fs.ErrNotExist) {
log.Warn().Msg("No config file found, using defaults")
return nil
}
return fmt.Errorf("fatal error reading config file: %w", err)
}