Skip to content

Commit 1f4bf9d

Browse files
authored
Merge pull request #151 from lionello/credentialsEndpoint-config
Add credentialsEndpoint config
2 parents e21b6fe + 33172a0 commit 1f4bf9d

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

plugin/s3ds.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,25 @@ func (s3p S3Plugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
9090
return nil, fmt.Errorf("s3ds: workers is not an integer: %f", workersf)
9191
}
9292
}
93+
var credentialsEndpoint string
94+
if v, ok := m["credentialsEndpoint"]; ok {
95+
credentialsEndpoint, ok = v.(string)
96+
if !ok {
97+
return nil, fmt.Errorf("s3ds: credentialsEndpoint not a string")
98+
}
99+
}
93100

94101
return &S3Config{
95102
cfg: s3ds.Config{
96-
Region: region,
97-
Bucket: bucket,
98-
AccessKey: accessKey,
99-
SecretKey: secretKey,
100-
SessionToken: sessionToken,
101-
RootDirectory: rootDirectory,
102-
Workers: workers,
103-
RegionEndpoint: endpoint,
103+
Region: region,
104+
Bucket: bucket,
105+
AccessKey: accessKey,
106+
SecretKey: secretKey,
107+
SessionToken: sessionToken,
108+
RootDirectory: rootDirectory,
109+
Workers: workers,
110+
RegionEndpoint: endpoint,
111+
CredentialsEndpoint: credentialsEndpoint,
104112
},
105113
}, nil
106114
}

plugin/s3ds_test.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,26 @@ func TestS3PluginDatastoreConfigParser(t *testing.T) {
3838
{
3939
// Optional fields included
4040
Input: map[string]interface{}{
41-
"region": "someregion",
42-
"bucket": "somebucket",
43-
"accessKey": "someaccesskey",
44-
"secretKey": "somesecretkey",
45-
"sessionToken": "somesessiontoken",
46-
"rootDirectory": "/some/path",
47-
"regionEndpoint": "someendpoint",
48-
"workers": 42.0,
41+
"region": "someregion",
42+
"bucket": "somebucket",
43+
"accessKey": "someaccesskey",
44+
"secretKey": "somesecretkey",
45+
"sessionToken": "somesessiontoken",
46+
"rootDirectory": "/some/path",
47+
"regionEndpoint": "someendpoint",
48+
"workers": 42.0,
49+
"credentialsEndpoint": "somecredendpoint",
4950
},
5051
Want: &S3Config{cfg: s3ds.Config{
51-
Region: "someregion",
52-
Bucket: "somebucket",
53-
AccessKey: "someaccesskey",
54-
SecretKey: "somesecretkey",
55-
SessionToken: "somesessiontoken",
56-
RootDirectory: "/some/path",
57-
RegionEndpoint: "someendpoint",
58-
Workers: 42,
52+
Region: "someregion",
53+
Bucket: "somebucket",
54+
AccessKey: "someaccesskey",
55+
SecretKey: "somesecretkey",
56+
SessionToken: "somesessiontoken",
57+
RootDirectory: "/some/path",
58+
RegionEndpoint: "someendpoint",
59+
Workers: 42,
60+
CredentialsEndpoint: "somecredendpoint",
5961
}},
6062
},
6163
}

0 commit comments

Comments
 (0)