Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit ffc2e03

Browse files
authored
Update index.js
Updating code to support AWS Key and policy
1 parent f09e519 commit ffc2e03

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/models/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ const fs = require('fs');
66
const dynamoose = require('dynamoose');
77
const config = require('../config');
88

9-
dynamoose.AWS.config.update({
10-
// accessKeyId: config.DYNAMODB.AWS_ACCESS_KEY_ID,
11-
// secretAccessKey: config.DYNAMODB.AWS_SECRET_ACCESS_KEY,
12-
region: config.DYNAMODB.AWS_REGION
13-
});
9+
const dynamooseConfig = {
10+
region: config.DYNAMODB.AWS_REGION
11+
}
12+
13+
if (config.DYNAMODB.AWS_ACCESS_KEY_ID) {
14+
dynamooseConfig.accessKeyId = config.DYNAMODB.AWS_ACCESS_KEY_ID;
15+
dynamooseConfig.secretAccessKey = config.DYNAMODB.AWS_SECRET_ACCESS_KEY;
16+
}
17+
18+
dynamoose.AWS.config.update(dynamooseConfig);
1419

1520
if (config.DYNAMODB.IS_LOCAL === 'true') {
1621
dynamoose.local();

0 commit comments

Comments
 (0)