Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

allow key prefix for all s3 images, configured via environment #224

Merged
merged 2 commits into from
Aug 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions serverless/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ functions:
- "-"
- Ref: AWS::Region
- -chromeless
CHROMELESS_S3_BUCKET_KEY_PREFIX: ""
CHROMELESS_S3_BUCKET_URL:
Fn::GetAtt:
- Bucket
Expand Down
3 changes: 2 additions & 1 deletion src/chrome/local-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ export default class LocalRuntime {
process.env['CHROMELESS_S3_BUCKET_NAME'] &&
process.env['CHROMELESS_S3_BUCKET_URL']
) {
const s3Path = `${cuid()}.png`
const prefix = process.env['CHROMELESS_S3_BUCKET_KEY_PREFIX'] || ''
const s3Path = `${prefix}${cuid()}.png`
const s3 = new AWS.S3()
await s3
.putObject({
Expand Down