You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-19 23:52:17 +02:00
feat: add ensure defaults to all migrated structs
Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
@@ -168,3 +168,23 @@ func NewFlagSet() *pflag.FlagSet {
|
||||
|
||||
return flagSet
|
||||
}
|
||||
|
||||
// EnsureDefaults configures the defaults for all options
|
||||
// to ensure no unexpected empty strings for enum types or nils for booleans
|
||||
func (o *Options) EnsureDefaults() {
|
||||
o.Providers.EnsureDefaults()
|
||||
o.UpstreamServers.EnsureDefaults()
|
||||
|
||||
for i := range o.InjectRequestHeaders {
|
||||
o.InjectRequestHeaders[i].EnsureDefaults()
|
||||
}
|
||||
for i := range o.InjectResponseHeaders {
|
||||
o.InjectResponseHeaders[i].EnsureDefaults()
|
||||
}
|
||||
|
||||
// TBD: Uncomment as we add EnsureDefaults methods
|
||||
// o.Cookie.EnsureDefaults()
|
||||
// o.Session.EnsureDefaults()
|
||||
// o.Templates.EnsureDefaults()
|
||||
// o.Logging.EnsureDefaults()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user