add error message when S3 config is missing
I figure we can get even better messages than "Access denied" in case this happens again! Also, I need a new deployment to trigger the new env vars, so why not make it count? :)
This commit is contained in:
parent
197dfd4e11
commit
61cdc9bca0
1 changed files with 10 additions and 0 deletions
|
@ -3,6 +3,16 @@ const Jimp = require("jimp");
|
||||||
|
|
||||||
const connectToDb = require("../src/server/db.js");
|
const connectToDb = require("../src/server/db.js");
|
||||||
|
|
||||||
|
if (
|
||||||
|
!process.env["DTI_AWS_ACCESS_KEY_ID"] ||
|
||||||
|
!process.env["DTI_AWS_SECRET_ACCESS_KEY"]
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`must provide DTI_AWS_ACCESS_KEY_ID and DTI_AWS_SECRET_ACCESS_KEY ` +
|
||||||
|
`environment variables`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const s3 = new AWS.S3({
|
const s3 = new AWS.S3({
|
||||||
accessKeyId: process.env["DTI_AWS_ACCESS_KEY_ID"],
|
accessKeyId: process.env["DTI_AWS_ACCESS_KEY_ID"],
|
||||||
secretAccessKey: process.env["DTI_AWS_SECRET_ACCESS_KEY"],
|
secretAccessKey: process.env["DTI_AWS_SECRET_ACCESS_KEY"],
|
||||||
|
|
Loading…
Reference in a new issue