Skip to content

Commit 4f17e88

Browse files
committed
Updated aws config
1 parent 69122e0 commit 4f17e88

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

plugin/ddbds.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,40 @@ func (p *DDBPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
4444

4545
accessKey, _ := m["accessKey"].(string)
4646
secretKey, _ := m["secretKey"].(string)
47-
sessionToken, _ := m["sessionToken"].(string)
47+
region, _ := m["region"].(string)
4848

4949
return &DDBConfig{
50-
Table: table,
51-
AccessKey: accessKey,
52-
SecretKey: secretKey,
53-
SessionToken: sessionToken,
50+
Table: table,
51+
AccessKey: accessKey,
52+
SecretKey: secretKey,
53+
Region: region,
5454
}, nil
5555
}
5656
}
5757

5858
type DDBConfig struct {
59-
Table string
60-
AccessKey string
61-
SecretKey string
62-
SessionToken string
59+
Table string
60+
AccessKey string
61+
SecretKey string
62+
Region string
6363
}
6464

6565
func (c *DDBConfig) DiskSpec() fsrepo.DiskSpec {
6666
return fsrepo.DiskSpec{
67-
"table": c.Table,
68-
"accessKey": c.AccessKey,
69-
"secretKey": c.SecretKey,
70-
"sessionToken": c.SessionToken,
67+
"table": c.Table,
68+
"accessKey": c.AccessKey,
69+
"secretKey": c.SecretKey,
70+
"region": c.Region
7171
}
7272
}
7373

7474
func (c *DDBConfig) Create(path string) (repo.Datastore, error) {
7575
awsConfig := &aws.Config{
76-
Region: aws.String("us-east-1"),
76+
Region: aws.String(c.Region),
7777
}
7878

7979
if c.AccessKey != "" && c.SecretKey != "" {
80-
awsConfig.Credentials = credentials.NewStaticCredentials(c.AccessKey, c.SecretKey, c.SessionToken)
80+
awsConfig.Credentials = credentials.NewStaticCredentials(c.AccessKey, c.SecretKey)
8181
}
8282

8383
sess, err := session.NewSession(awsConfig)

0 commit comments

Comments
 (0)