Do not add region for mc, since mc treats with URLs not regions
This commit is contained in:
Generated
+1
-1
@@ -36,7 +36,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/minio/objectstorage-go",
|
||||
"Rev": "a6e37582197d43a87e152326d4d683878b97a969"
|
||||
"Rev": "ee88d26b8cc8a588556e3111827d35bd1f2a7169"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/shiena/ansicolor",
|
||||
|
||||
+15
-6
@@ -131,17 +131,26 @@ type Config struct {
|
||||
// MustGetEndpoint makes sure that a valid endpoint is provided all the time, even with false regions it will fall
|
||||
// back to default, for no regions specified it chooses to default to "milkyway" and use endpoint as is
|
||||
func (c *Config) MustGetEndpoint() string {
|
||||
// for custom domains, there are no regions default to 'milkyway'
|
||||
if strings.TrimSpace(c.Region) == "" && strings.TrimSpace(c.Endpoint) != "" {
|
||||
if strings.TrimSpace(c.Endpoint) != "" {
|
||||
if strings.Contains(strings.TrimSpace(c.Endpoint), "s3.amazonaws.com") {
|
||||
c.Region = "us-east-1"
|
||||
return getEndpoint(c.Region)
|
||||
}
|
||||
// for custom domains, there are no regions default to 'milkyway'
|
||||
c.Region = "milkyway"
|
||||
return c.Endpoint
|
||||
}
|
||||
// if valid region provided override user provided endpoint
|
||||
if endpoint := getEndpoint(strings.TrimSpace(c.Region)); endpoint != "" {
|
||||
c.Endpoint = endpoint
|
||||
return c.Endpoint
|
||||
if strings.TrimSpace(c.Region) != "" {
|
||||
if endpoint := getEndpoint(strings.TrimSpace(c.Region)); endpoint != "" {
|
||||
c.Endpoint = endpoint
|
||||
return c.Endpoint
|
||||
}
|
||||
// fall back if region is set and not found, go through US-standard
|
||||
c.Region = "us-east-1"
|
||||
return getEndpoint(c.Region)
|
||||
}
|
||||
// fall back if region is set and not found, go through US-standard
|
||||
// if not endpoint or region sepcified default to us-east-1
|
||||
c.Region = "us-east-1"
|
||||
return getEndpoint(c.Region)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ func New(config *Config) client.Client {
|
||||
objectstorageConf.AccessKeyID = config.AccessKeyID
|
||||
objectstorageConf.SecretAccessKey = config.SecretAccessKey
|
||||
objectstorageConf.UserAgent = config.UserAgent
|
||||
objectstorageConf.Region = "us-east-1"
|
||||
objectstorageConf.Transport = transport
|
||||
objectstorageConf.Endpoint = u.Scheme + "://" + u.Host
|
||||
api := objectstorage.New(objectstorageConf)
|
||||
|
||||
Reference in New Issue
Block a user