Lowercase ACL Datacenter (#2478)

* Lowercase ACL Datacenter

* move lowercasing of ACLDatacenter to command.go and add validation

* Tweaks error message about bad ACL datacenter.
This commit is contained in:
Brian Hays 2016-11-07 21:41:23 -05:00 committed by James Phillips
parent 6de74c60a4
commit 1c01b10c87
1 changed files with 11 additions and 0 deletions

View File

@ -274,6 +274,17 @@ func (c *Command) readConfig() *Config {
return nil
}
// If 'acl_datacenter' is set, ensure it is lowercased.
if config.ACLDatacenter != "" {
config.ACLDatacenter = strings.ToLower(config.ACLDatacenter)
// Verify 'acl_datacenter' is valid
if !validDatacenter.MatchString(config.ACLDatacenter) {
c.Ui.Error("ACL datacenter must be alpha-numeric with underscores and hypens only")
return nil
}
}
// Only allow bootstrap mode when acting as a server
if config.Bootstrap && !config.Server {
c.Ui.Error("Bootstrap mode cannot be enabled when server mode is not enabled")