1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-08-10 13:46:46 +02:00

don't crash if config file is missing

This commit is contained in:
Stavros Kois 2025-06-24 19:11:01 +03:00
parent e73b2a9fb9
commit f7ba92a94e
No known key found for this signature in database
GPG Key ID: 52FD8F5EE0A731BB

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)
}