Skip to content

Commit

Permalink
fix: AWS_ env var check
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Marquart committed Jul 10, 2023
1 parent 870f2fa commit 73e997e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ module.exports = {
);
}

if (!Object.keys(process.env).find((key) => key.startsWith("AWS_"))) {
const aws_keys = Object.keys(process.env).filter((key) =>
key.startsWith("AWS_")
);
if (aws_keys.length > 0) {
console.warn(
"\x1b[43mWARNING (strapi-provider-cloudflare-r2):\x1b[0m You are using strapi-provider-cloudflare-r2 and still have AWS_... env vars from provider-upload-aws-s3 set. This could conflict with Cloudflare R2 provider. Please remove unused AWS_ env variables or rename+change them in plugin config. See more: https://github.com/trieb-work/strapi-provider-cloudflare-r2#aws-sdk-configuration-and-aws_-env-variables"
`\x1b[43mWARNING (strapi-provider-cloudflare-r2):\x1b[0m You are using strapi-provider-cloudflare-r2 and still have AWS_... env vars from provider-upload-aws-s3 set. This could conflict with Cloudflare R2 provider. Please remove ${aws_keys.join(
", "
)} env variable(s) or rename+change them in plugin config. See more: https://github.com/trieb-work/strapi-provider-cloudflare-r2#aws-sdk-configuration-and-aws_-env-variables`
);
}

Expand Down

0 comments on commit 73e997e

Please sign in to comment.