Parse alias set via env variable while prsing encryption key (#2581)

Check MC_HOSTS_ env variable also while looking for the alias to set encryption key
Fixes #2580
This commit is contained in:
kannappanr
2018-10-26 12:51:57 -07:00
committed by GitHub
parent 96378448c5
commit 73a61b4203
+7
View File
@@ -174,6 +174,13 @@ func getHostConfig(alias string) (*hostConfigV9, *probe.Error) {
// mustGetHostConfig retrieves host specific configuration such as access keys, signature type.
func mustGetHostConfig(alias string) *hostConfigV9 {
hostCfg, _ := getHostConfig(alias)
// If alias is not found,
// look for it in the environment variable.
if hostCfg == nil {
if envConfig, ok := os.LookupEnv(mcEnvHostsPrefix + alias); ok {
hostCfg, _ = expandAliasFromEnv(envConfig)
}
}
return hostCfg
}