split out authentication options

This commit is contained in:
deads2k
2016-11-09 13:14:20 -05:00
parent 56b7a8b02b
commit 7c0e48f544
10 changed files with 386 additions and 205 deletions

View File

@@ -282,6 +282,15 @@ func (c *Config) ApplyInsecureServingOptions(insecureServing *options.ServingOpt
return c
}
func (c *Config) ApplyAuthenticationOptions(o *options.BuiltInAuthenticationOptions) *Config {
if o == nil || o.PasswordFile == nil {
return c
}
c.SupportsBasicAuth = len(o.PasswordFile.BasicAuthFile) > 0
return c
}
// ApplyOptions applies the run options to the method receiver and returns self
func (c *Config) ApplyOptions(options *options.ServerRunOptions) *Config {
if len(options.AuditLogPath) != 0 {
@@ -303,7 +312,6 @@ func (c *Config) ApplyOptions(options *options.ServerRunOptions) *Config {
c.MaxRequestsInFlight = options.MaxRequestsInFlight
c.MinRequestTimeout = options.MinRequestTimeout
c.PublicAddress = options.AdvertiseAddress
c.SupportsBasicAuth = len(options.BasicAuthFile) > 0
return c
}