Only check validity of S3 region if not using custom endpoint
Signed-off-by: Arien Holthuizen <aholthuizen@schubergphilis.com>
This commit is contained in:
parent
dafb59f4ab
commit
64a9727f11
1 changed files with 10 additions and 8 deletions
|
@ -136,26 +136,28 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) {
|
||||||
secretKey = ""
|
secretKey = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regionEndpoint := parameters["regionendpoint"]
|
||||||
|
if regionEndpoint == nil {
|
||||||
|
regionEndpoint = ""
|
||||||
|
}
|
||||||
|
|
||||||
regionName, ok := parameters["region"]
|
regionName, ok := parameters["region"]
|
||||||
if regionName == nil || fmt.Sprint(regionName) == "" {
|
if regionName == nil || fmt.Sprint(regionName) == "" {
|
||||||
return nil, fmt.Errorf("No region parameter provided")
|
return nil, fmt.Errorf("No region parameter provided")
|
||||||
}
|
}
|
||||||
region := fmt.Sprint(regionName)
|
region := fmt.Sprint(regionName)
|
||||||
_, ok = validRegions[region]
|
// Don't check the region value if a custom endpoint is provided.
|
||||||
if !ok {
|
if regionEndpoint == "" {
|
||||||
|
if _, ok = validRegions[region]; !ok {
|
||||||
return nil, fmt.Errorf("Invalid region provided: %v", region)
|
return nil, fmt.Errorf("Invalid region provided: %v", region)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bucket := parameters["bucket"]
|
bucket := parameters["bucket"]
|
||||||
if bucket == nil || fmt.Sprint(bucket) == "" {
|
if bucket == nil || fmt.Sprint(bucket) == "" {
|
||||||
return nil, fmt.Errorf("No bucket parameter provided")
|
return nil, fmt.Errorf("No bucket parameter provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
regionEndpoint := parameters["regionendpoint"]
|
|
||||||
if regionEndpoint == nil {
|
|
||||||
regionEndpoint = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
encryptBool := false
|
encryptBool := false
|
||||||
encrypt := parameters["encrypt"]
|
encrypt := parameters["encrypt"]
|
||||||
switch encrypt := encrypt.(type) {
|
switch encrypt := encrypt.(type) {
|
||||||
|
|
Loading…
Reference in a new issue