Skip to content

Commit 155de56

Browse files
author
JoshuaT
committed
Remove baked config. Add ACL permission. Alter package script
1 parent 85362aa commit 155de56

File tree

10 files changed

+8
-39
lines changed

10 files changed

+8
-39
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ Managing table redundancy and backups involves many moving parts. Please read [D
1818

1919
### Config and Packaging
2020

21-
For windows users: a powershell script is available to packing the lambda function with a preset config file consisting of environment variables.
22-
Once the script is run, you will be prompted for the name of the config file you would like to deploy alongside your function.
23-
The config files should be stored under .\config\
21+
For windows users: a powershell script is available to packing the lambda function with all the packages it needs.
2422

2523
```
24+
> npm install
2625
> .\package.ps1
27-
> What is the name of the config file you would like to load: Forms-dc4.env
2826
2927
### diff-record
3028

config/Forms-dc2.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc3.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc4.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc5.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc6.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc7.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/Forms-dc8.env

Lines changed: 0 additions & 4 deletions
This file was deleted.

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
var AWS = require('aws-sdk');
32
var Dyno = require('dyno');
43
var queue = require('queue-async');
@@ -170,7 +169,11 @@ function incrementalBackup(event, context, callback) {
170169
};
171170

172171
var req = change.eventName === 'REMOVE' ? 'deleteObject' : 'putObject';
173-
if (req === 'putObject') params.Body = JSON.stringify(change.dynamodb.NewImage);
172+
173+
if (req === 'putObject') {
174+
params.Body = JSON.stringify(change.dynamodb.NewImage);
175+
params.ACL = 'bucket-owner-full-control';
176+
}
174177

175178
s3[req](params, function(err) {
176179
if (err) console.log(

package.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ if (Test-Path .\package) {
33
Remove-Item .\package -Recurse -Force
44
}
55

6-
76
New-Item .\package -type directory -f | Out-Null
87
New-Item .\package\temp -type directory -f | Out-Null
98
Write-Output "Copying dependencies..."
@@ -14,11 +13,8 @@ Copy-Item .\s3-snapshot.js .\package\temp\
1413
robocopy .\node_modules\ .\package\temp\ /E | Out-Null
1514
Write-Output "Dependencies sorted"
1615

17-
$environmentFile = Read-Host -Prompt 'Enter the name of the config file you would like to add to your deployment (e.g. Forms-dc4.env)'
18-
1916
Write-Output "Generating output..."
20-
New-Item .\package\temp\index.js -type file -f | Out-Null
21-
get-content .\config\$environmentFile,".\index.js" | set-content ".\package\temp\index.js"
17+
Copy-Item .\index.js .\package\temp\
2218
Write-Output "Output generated"
2319

2420
Add-Type -assembly "system.io.compression.filesystem"

0 commit comments

Comments
 (0)