diff --git a/config.go b/config.go index c78b0dd3..bbc52f4d 100644 --- a/config.go +++ b/config.go @@ -190,6 +190,11 @@ func newConfig() (config quick.Config, err error) { s3HostConf.AccessKeyID = globalAccessKeyID s3HostConf.SecretAccessKey = globalSecretAccessKey + // Your example host config + exampleHostConf := new(hostConfig) + exampleHostConf.AccessKeyID = globalAccessKeyID + exampleHostConf.SecretAccessKey = globalSecretAccessKey + playHostConfig := new(hostConfig) playHostConfig.AccessKeyID = "" playHostConfig.SecretAccessKey = "" @@ -198,12 +203,13 @@ func newConfig() (config quick.Config, err error) { dlHostConfig.AccessKeyID = "" dlHostConfig.SecretAccessKey = "" - // Your example host config - exampleHostConf := new(hostConfig) - exampleHostConf.AccessKeyID = globalAccessKeyID - exampleHostConf.SecretAccessKey = globalSecretAccessKey + localHostConfig := new(hostConfig) + localHostConfig.AccessKeyID = "" + localHostConfig.SecretAccessKey = "" conf.Hosts[exampleHostURL] = exampleHostConf + conf.Hosts["localhost:*"] = localHostConfig + conf.Hosts["127.0.0.1:*"] = localHostConfig conf.Hosts["s3*.amazonaws.com"] = s3HostConf conf.Hosts["play.minio.io:9000"] = playHostConfig conf.Hosts["dl.minio.io:9000"] = dlHostConfig diff --git a/hostconfig.go b/hostconfig.go index 9dc0226a..6a3ef03e 100644 --- a/hostconfig.go +++ b/hostconfig.go @@ -18,7 +18,6 @@ package main import ( "path/filepath" - "strings" "github.com/minio/mc/pkg/client" "github.com/minio/mc/pkg/console" @@ -48,14 +47,7 @@ func getHostConfig(URL string) (*hostConfig, error) { } return hostCfg, nil } - // No host matching or keys needed for 127.0.0.1 URL's skip them - if strings.Contains(url.Host, "127.0.0.1") { - hostCfg := &hostConfig{ - AccessKeyID: "", - SecretAccessKey: "", - } - return hostCfg, nil - } + for globURL, hostCfg := range config.Hosts { match, err := filepath.Match(globURL, url.Host) if err != nil {