diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2023-11-23 08:20:36 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-23 08:20:36 +1100 |
| commit | c49b973120c7fd755923a2b88afd794c7d320d6e (patch) | |
| tree | 5fcef6de1a85568eee3c67470f73b790b294dda8 /internal/configuration/validator/authentication.go | |
| parent | fa141929a39e546f3f3ca6bcbc7bd72c64e575c8 (diff) | |
fix(configuration): illogical refresh interval default (#6319)
When using the file provider with watch enabled, the refresh interval should just be set to always default as the cost is minimal.
Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/configuration/validator/authentication.go')
| -rw-r--r-- | internal/configuration/validator/authentication.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/internal/configuration/validator/authentication.go b/internal/configuration/validator/authentication.go index 8740e9e6d..b46caea2c 100644 --- a/internal/configuration/validator/authentication.go +++ b/internal/configuration/validator/authentication.go @@ -20,12 +20,11 @@ func ValidateAuthenticationBackend(config *schema.AuthenticationBackend, validat validator.Push(fmt.Errorf(errFmtAuthBackendNotConfigured)) } - if config.RefreshInterval == "" { - config.RefreshInterval = schema.RefreshIntervalDefault - } else { - _, err := utils.ParseDurationString(config.RefreshInterval) - if err != nil && config.RefreshInterval != schema.ProfileRefreshDisabled && config.RefreshInterval != schema.ProfileRefreshAlways { - validator.Push(fmt.Errorf(errFmtAuthBackendRefreshInterval, config.RefreshInterval, err)) + if !config.RefreshInterval.Valid() { + if config.File != nil && config.File.Watch { + config.RefreshInterval = schema.NewRefreshIntervalDurationAlways() + } else { + config.RefreshInterval = schema.NewRefreshIntervalDuration(schema.RefreshIntervalDefault) } } |
