mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-12 00:27:35 +02:00
config: validate databroker settings (#1260)
* config: validate databroker settings * fix test
This commit is contained in:
parent
877edde0be
commit
bd5c784670
2 changed files with 18 additions and 10 deletions
|
@ -74,12 +74,6 @@ func (src *ConfigSource) rebuild(firstTime bool) {
|
|||
defer src.mu.Unlock()
|
||||
|
||||
cfg := src.underlyingConfig.Clone()
|
||||
defer func() {
|
||||
src.computedConfig = cfg
|
||||
if !firstTime {
|
||||
src.Trigger(cfg)
|
||||
}
|
||||
}()
|
||||
|
||||
// start the updater
|
||||
src.runUpdater(cfg)
|
||||
|
@ -105,6 +99,7 @@ func (src *ConfigSource) rebuild(firstTime bool) {
|
|||
log.Warn().Err(err).
|
||||
Str("policy", policy.String()).
|
||||
Msg("databroker: invalid policy, ignoring")
|
||||
continue
|
||||
}
|
||||
|
||||
routeID := policy.RouteID()
|
||||
|
@ -119,6 +114,17 @@ func (src *ConfigSource) rebuild(firstTime bool) {
|
|||
|
||||
cfg.Options.Policies = append(cfg.Options.Policies, *policy)
|
||||
}
|
||||
|
||||
err := cfg.Options.Validate()
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("databroker: invalid config detected, ignoring")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
src.computedConfig = cfg
|
||||
if !firstTime {
|
||||
src.Trigger(cfg)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue