Skip to content

Commit

Permalink
refactor: set aws variables in .env
Browse files Browse the repository at this point in the history
  • Loading branch information
eowfenth committed Apr 29, 2020
1 parent deef9f4 commit ecb9c09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ DB_USER=
DB_PASSWORD=
DB_PORT=
JWT_SECRET=
JWT_EXPIRE_TIME=
JWT_EXPIRE_TIME=
UPLOAD_STORAGE=
AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_S3_BUCKETNAME=
2 changes: 1 addition & 1 deletion src/utils/upload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ecb9c09

Please sign in to comment.