| 3 | require('dotenv').config(); |
| 4 | |
| 5 | function getS3Config(S3_BUCKET, fileType, fileName) { |
| 6 | // We should Make this options a helper method: |
| 7 | aws.config.region = 'us-west-2'; |
| 8 | // const fileName = 'record-red-bg-180-2.png'; // This can be anything |
| 9 | // const fileType = 'image/png'; // req.query['file-type']; |
| 10 | const s3Params = { |
| 11 | Bucket: S3_BUCKET, |
| 12 | Key: fileName, |
| 13 | Expires: 60, // in seconds |
| 14 | ContentType: fileType, |
| 15 | ACL: 'public-read' |
| 16 | }; |
| 17 | return s3Params; |
| 18 | } |
| 19 | |
| 20 | function signS3(S3_BUCKET, fileType, newFileName, cbSuccess, cbError) { |
| 21 | // Probably only need to do this once: |