mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-14 13:51:01 +02:00
don't crash if config file is missing
This commit is contained in:
parent
e73b2a9fb9
commit
f7ba92a94e
@ -335,6 +335,10 @@ func LoadConfig(path string, isFile bool) error {
|
|||||||
viper.SetDefault("prefixes.allocation", string(IPAllocationStrategySequential))
|
viper.SetDefault("prefixes.allocation", string(IPAllocationStrategySequential))
|
||||||
|
|
||||||
if err := viper.ReadInConfig(); err != nil {
|
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)
|
return fmt.Errorf("fatal error reading config file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user