@@ -184,9 +184,9 @@ func (c *Config) RegisterFlags(f *flag.FlagSet) {
184
184
// Validate the cortex config and returns an error if the validation
185
185
// doesn't pass
186
186
func (c * Config ) Validate (log log.Logger ) error {
187
- if c .NameValidationScheme != "" &&
188
- c . NameValidationScheme != prom_config .LegacyValidationConfig &&
189
- c . NameValidationScheme != prom_config . UTF8ValidationConfig {
187
+ switch c .NameValidationScheme {
188
+ case "" , prom_config .LegacyValidationConfig , prom_config . UTF8ValidationConfig :
189
+ default :
190
190
return fmt .Errorf ("invalid name validation scheme: %s" , c .NameValidationScheme )
191
191
}
192
192
if err := c .validateYAMLEmptyNodes (); err != nil {
@@ -357,13 +357,10 @@ func New(cfg Config) (*Cortex, error) {
357
357
}
358
358
os .Exit (0 )
359
359
}
360
- switch cfg .NameValidationScheme {
361
- case "" , prom_config .LegacyValidationConfig :
362
- model .NameValidationScheme = model .LegacyValidation
363
- case prom_config .UTF8ValidationConfig :
360
+ if cfg .NameValidationScheme == prom_config .UTF8ValidationConfig {
364
361
model .NameValidationScheme = model .UTF8Validation
365
- default :
366
- return nil , fmt . Errorf ( "invalid name validation scheme" )
362
+ } else {
363
+ model . NameValidationScheme = model . LegacyValidation
367
364
}
368
365
// Swap out the default resolver to support multiple tenant IDs separated by a '|'
369
366
if cfg .TenantFederation .Enabled {
0 commit comments