config: Do not validate creds when set via env (#3955)

It is useless to validate access/secret keys stored in
config file when the user sets them in the environment.
This commit is contained in:
Anis Elleuch 2017-03-23 00:11:58 +01:00 committed by Harshavardhana
parent d4ca2ee1a3
commit 7f5a5b5e9d
1 changed files with 6 additions and 3 deletions

View File

@ -235,9 +235,12 @@ func validateConfig() error {
return fmt.Errorf("Browser config value %s is invalid", b)
}
// Validate credential field
if !srvCfg.Credential.IsValid() {
return errors.New("invalid credential")
// Validate credential fields only when
// they are not set via the environment
if !globalIsEnvCreds {
if !srvCfg.Credential.IsValid() {
return errors.New("invalid credential")
}
}
// Validate logger field