Skip to content

Commit 891fe9a

Browse files
Arthur Cinaderflovilmart
authored andcommitted
Add option to configure bucket prefix. (#5)
Also add default answer for AWS_* info.
1 parent 4e0923d commit 891fe9a

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ node_modules
3333
.node_repl_history
3434

3535
.DS_Store
36+
37+
config.js

config.example.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
serverURL: "https://api.customparseserver.com/parse",
1010
filesToTransfer: 'parseOnly',
1111
renameInDatabase: false,
12+
transferTo: 'filesystem',
1213

1314
// For filesystem configuration
1415
filesystemPath: './downloaded_files',
@@ -17,6 +18,7 @@ module.exports = {
1718
aws_accessKeyId: "ACCESS_KEY_ID",
1819
aws_secretAccessKey: "SECRET_ACCESS_KEY",
1920
aws_bucket: "BUCKET_NAME",
21+
aws_bucketPrefix: "",
2022

2123
// For GCS configuration
2224
gcs_projectId: "GCS_PROJECT_ID",

lib/questions.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ function questions(config) {
9494
return (answers.transferTo == 's3' || config.transferTo == 's3') &&
9595
!config.aws_accessKeyId &&
9696
!config.aws_profile;
97-
}
97+
},
98+
default: process.env.AWS_ACCESS_KEY_ID
9899
}, {
99100
type: 'input',
100101
name: 'aws_secretAccessKey',
@@ -103,7 +104,8 @@ function questions(config) {
103104
return (answers.transferTo == 's3' || config.transferTo == 's3') &&
104105
!config.aws_secretAccessKey &&
105106
!config.aws_profile;
106-
}
107+
},
108+
default: process.env.AWS_SECRET_ACCESS_KEY
107109
}, {
108110
type: 'input',
109111
name: 'aws_bucket',
@@ -113,6 +115,15 @@ function questions(config) {
113115
!config.aws_bucket;
114116
}
115117
},
118+
{
119+
type: 'input',
120+
name: 'aws_bucketPrefix',
121+
message: 'S3 bucket prefix (optional)',
122+
when: function (answers) {
123+
return (answers.transferTo == 's3' || config.transferTo == 's3') &&
124+
!config.aws_bucketPrefix;
125+
}
126+
},
116127

117128
// GCS settings
118129
{

lib/schemas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function get() {
1010
headers: {
1111
'Content-Type': 'application/json',
1212
'X-Parse-Application-Id': Parse.applicationId,
13-
'X-Parse-Master-Key': Parse.masterKey
13+
'X-Parse-Master-Key': Parse.masterKey
1414
}
1515
}, function(err, res, body) {
1616
if (err) {

lib/transfer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function _setup() {
5050
accessKey: config.aws_secretAccessKey,
5151
secretKey: config.aws_secretAccessKey,
5252
bucket: config.aws_bucket,
53+
bucketPrefix: config.aws_bucketPrefix,
5354
directAccess: true
5455
});
5556
} else if (config.transferTo == 'gcs') {

0 commit comments

Comments
 (0)