-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_update_code.js
More file actions
39 lines (35 loc) · 1.11 KB
/
run_update_code.js
File metadata and controls
39 lines (35 loc) · 1.11 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
38
39
var argv = require('minimist')(process.argv.slice(2));
var folder = argv['folder'];
var account = argv['account'];
var region = argv['region'];
if (!folder || !account || !region) {
console.log("node run_upload_code --folder <folder name> --account <aws account id> --region <aws region>");
return;
}
if (account.toString().length < 12) {
account = "0" + account;
}
console.log('folder = ' + folder);
console.log('account = ' + account);
console.log('region = ' + region);
var fs = require("fs");
var data = fs.readFileSync(__dirname + '/' + folder + "/config.json", {encoding:'utf8'});
var input = JSON.parse(data);
input.bucketName = account + input.bucketName + region;
input.region = region;
console.log(input);
var updator = new (require('../aws-services/lib/lambda_code_updator'))();
updator.update(input, function(err, data) {
if(err) {
console.log("Error occurred during updating codes : " + JSON.stringify(err));
process.exit(1);
}
else if(data) {
console.log("Successfully updated codes");
process.exit(0);
}
else {
console.log("Failed to update codes");
process.exit(1);
}
});