2
0

chore: ♻️ Better S3 env var format

This commit is contained in:
Baptiste Arnaud
2022-02-14 07:52:12 +01:00
parent 1033e42b60
commit 9c20ef00b9
2 changed files with 8 additions and 8 deletions

View File

@@ -17,10 +17,10 @@ NEXT_PUBLIC_EMAIL_NOTIFICATIONS_FROM_EMAIL=
# Storage # Storage
# Used for uploading images, videos, etc... # Used for uploading images, videos, etc...
S3_UPLOAD_KEY= S3_ACCESS_KEY=
S3_UPLOAD_SECRET= S3_SECRET_KEY=
S3_UPLOAD_REGION= S3_REGION=
S3_UPLOAD_BUCKET= S3_BUCKET=
# Auth # Auth
# (Optional) Used to login using GitHub # (Optional) Used to login using GitHub

View File

@@ -16,15 +16,15 @@ const handler = async (
return return
} }
aws.config.update({ aws.config.update({
accessKeyId: process.env.S3_UPLOAD_KEY, accessKeyId: process.env.S3_ACCESS_KEY,
secretAccessKey: process.env.S3_UPLOAD_SECRET, secretAccessKey: process.env.S3_SECRET_KEY,
region: process.env.S3_UPLOAD_REGION, region: process.env.S3_REGION,
signatureVersion: 'v4', signatureVersion: 'v4',
}) })
const s3 = new aws.S3() const s3 = new aws.S3()
const post = s3.createPresignedPost({ const post = s3.createPresignedPost({
Bucket: process.env.S3_UPLOAD_BUCKET, Bucket: process.env.S3_BUCKET,
Fields: { Fields: {
ACL: 'public-read', ACL: 'public-read',
key: req.query.key, key: req.query.key,