diff --git a/lib/index.js b/lib/index.js index 04eac81..3fcc505 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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` ); }