mirror of
https://github.com/juanfont/headscale.git
synced 2025-07-18 13:12:50 -04:00
don't crash if config file is missing (#2656)
This commit is contained in:
parent
3bad5d5590
commit
ded049b905
@ -16,6 +16,8 @@
|
|||||||
[#2046](https://github.com/juanfont/headscale/pull/2046)
|
[#2046](https://github.com/juanfont/headscale/pull/2046)
|
||||||
- Refactor OpenID Connect documentation
|
- Refactor OpenID Connect documentation
|
||||||
[#2625](https://github.com/juanfont/headscale/pull/2625)
|
[#2625](https://github.com/juanfont/headscale/pull/2625)
|
||||||
|
- Don't crash if config file is missing
|
||||||
|
[#2656](https://github.com/juanfont/headscale/pull/2656)
|
||||||
|
|
||||||
## 0.26.1 (2025-06-06)
|
## 0.26.1 (2025-06-06)
|
||||||
|
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user