-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.js
More file actions
37 lines (29 loc) · 1 KB
/
settings.js
File metadata and controls
37 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { S3Client } = require("@aws-sdk/client-s3");
const { fromIni } = require("@aws-sdk/credential-providers");
require('dotenv').config();
//
// This file is intended to handle environment variables
// and create objects to be passed to the functions inside
// actions.js file.
//
const config = {
credentials: fromIni({profile: 'default'})
};
const srcRegion = process.env.SRCREGION;
const dstRegion = process.env.DSTREGION;
const keyOffset = process.env.KEYOFFSET;
const logPath = process.env.LOGPATH;
const srcInput = {
Bucket: process.env.SRCBUCKET,
MaxKeys: Number(process.env.MAXKEYS),
Prefix: process.env.SRCPREFIX,
RequestPayer: process.env.REQUESTPAYER,
};
// If there is offset pass it to srcInput
if (keyOffset) srcInput.StartAfter = keyOffset;
const dstInput = {
Bucket: process.env.DSTBUCKET,
};
const srcS3 = new S3Client({ region: srcRegion, ...config });
const dstS3 = new S3Client({ region: dstRegion, ...config });
module.exports = { srcInput, dstInput, srcS3, dstS3, logPath };