config: list hosts only present in config.

Fixes #1285
This commit is contained in:
Harshavardhana
2015-11-12 13:34:05 -08:00
parent a523baf1fc
commit 54e24eccaa
2 changed files with 17 additions and 3 deletions
+7 -1
View File
@@ -133,7 +133,13 @@ func mainConfigHost(ctx *cli.Context) {
}
func listHosts() {
config, err := newConfig()
conf := new(configV6)
conf.Version = globalMCConfigVersion
// make sure to allocate map's otherwise Golang
// exits silently without providing any errors
conf.Hosts = make(map[string]hostConfig)
conf.Aliases = make(map[string]string)
config, err := quick.New(conf)
fatalIf(err.Trace(), "Failed to initialize ‘quick’ configuration data structure.")
configPath := mustGetMcConfigPath()
+10 -2
View File
@@ -426,11 +426,19 @@ func migrateConfigV5ToV6() {
confV6.Aliases["gcs"] = "https://storage.googleapis.com"
confV6.Hosts = make(map[string]hostConfig)
for host, hostConf := range mcConfigV5.Data().(*configV5).Hosts {
confV6.Hosts[host] = hostConf
confV6.Hosts[host] = hostConfig{
AccessKeyID: hostConf.AccessKeyID,
SecretAccessKey: hostConf.SecretAccessKey,
API: hostConf.API,
}
}
for host, hostConf := range confV6.Hosts {
if strings.Contains(host, "s3") {
confV6.Hosts["*s3*amazonaws.com"] = hostConf
confV6.Hosts["*s3*amazonaws.com"] = hostConfig{
AccessKeyID: hostConf.AccessKeyID,
SecretAccessKey: hostConf.SecretAccessKey,
API: hostConf.API,
}
break
}
}