mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-18 19:47:22 +02:00
* Add runtime flag to allow disabling config hot-reload (#5079) * Add unit tests * Log at info level instead of warning
This commit is contained in:
parent
114f730dba
commit
c3534df885
3 changed files with 189 additions and 52 deletions
|
@ -134,7 +134,12 @@ func NewFileOrEnvironmentSource(
|
|||
config: cfg,
|
||||
}
|
||||
if configFile != "" {
|
||||
src.watcher.Watch(ctx, []string{configFile})
|
||||
if cfg.Options.IsRuntimeFlagSet(RuntimeFlagConfigHotReload) {
|
||||
src.watcher.Watch(ctx, []string{configFile})
|
||||
} else {
|
||||
log.Info(ctx).Msg("hot reload disabled")
|
||||
src.watcher.Watch(ctx, nil)
|
||||
}
|
||||
}
|
||||
ch := src.watcher.Bind()
|
||||
go func() {
|
||||
|
@ -223,7 +228,11 @@ func (src *FileWatcherSource) GetConfig() *Config {
|
|||
|
||||
func (src *FileWatcherSource) onConfigChange(ctx context.Context, cfg *Config) {
|
||||
// update the file watcher with paths from the config
|
||||
src.watcher.Watch(ctx, getAllConfigFilePaths(cfg))
|
||||
if cfg.Options.IsRuntimeFlagSet(RuntimeFlagConfigHotReload) {
|
||||
src.watcher.Watch(ctx, getAllConfigFilePaths(cfg))
|
||||
} else {
|
||||
src.watcher.Watch(ctx, nil)
|
||||
}
|
||||
|
||||
src.mu.Lock()
|
||||
defer src.mu.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue