Browse Source
core: Load config at interval instead of just once
master
Matthew Holt
3 years ago
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5
1 changed files with
12 additions and
9 deletions
-
caddy.go
|
|
@ -493,6 +493,7 @@ func finishSettingUp(ctx Context, cfg *Config) error { |
|
|
|
} |
|
|
|
if cfg.Admin.Config.LoadInterval > 0 { |
|
|
|
go func() { |
|
|
|
for { |
|
|
|
select { |
|
|
|
// if LoadInterval is positive, will wait for the interval and then run with new config
|
|
|
|
case <-time.After(time.Duration(cfg.Admin.Config.LoadInterval)): |
|
|
@ -503,8 +504,10 @@ func finishSettingUp(ctx Context, cfg *Config) error { |
|
|
|
} |
|
|
|
runLoadedConfig(loadedConfig) |
|
|
|
case <-ctx.Done(): |
|
|
|
Log().Info("stopping config load interval") |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}() |
|
|
|
} else { |
|
|
|
// if no LoadInterval is provided, will load config synchronously
|
|
|
|