From ecb9c0963ffd5c0abdf51ac27effdc564ea2c3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20=27nohaleh=27=20De=C3=A7ordi?= Date: Wed, 29 Apr 2020 13:22:33 -0300 Subject: [PATCH] refactor: set aws variables in .env --- .env-example | 6 +++++- src/utils/upload/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env-example b/.env-example index 1c82494..6a15be5 100644 --- a/.env-example +++ b/.env-example @@ -5,4 +5,8 @@ DB_USER= DB_PASSWORD= DB_PORT= JWT_SECRET= -JWT_EXPIRE_TIME= \ No newline at end of file +JWT_EXPIRE_TIME= +UPLOAD_STORAGE= +AWS_ACCESS_KEY= +AWS_SECRET_KEY= +AWS_S3_BUCKETNAME= \ No newline at end of file diff --git a/src/utils/upload/index.js b/src/utils/upload/index.js index 487c5af..ef27436 100644 --- a/src/utils/upload/index.js +++ b/src/utils/upload/index.js @@ -21,7 +21,7 @@ const S3Storage = { storage: multerS3({ s3: s3, acl: 'public-read', - bucket: 'matching-app-bucket', + bucket: process.env.AWS_S3_BUCKETNAME, metadata: (req, file, cb) => { cb(null, { fieldName: file.fieldname })}, key: (req, file, cb) => { const uniquePrefix = Date.now() + '-' + Math.round(Math.random() * 1E9);