next-s3-upload icon indicating copy to clipboard operation
next-s3-upload copied to clipboard

Where to store environment variables with client-side env store?

Open taylor-lindores-reeves opened this issue 2 years ago • 4 comments

Currently we are storing env vars for S3 secret keys in .env.local but of course this is a security risk. Please could you let me know what is a best practice to store when working with next-s3-upload?

taylor-lindores-reeves avatar Sep 07 '22 09:09 taylor-lindores-reeves

Hi there!

When working in development you should store your secrets in .env.local, but not check this file into git. You can read more here: https://nextjs.org/docs/basic-features/environment-variables

For production deployments you should use your web hosts recommended way for storing env variables. If you're using Vercel these envs can be set under the project settings page: https://vercel.com/docs/concepts/projects/environment-variables?utm_source=next-site&utm_medium=docs&utm_campaign=next-website

Let me know if you have any questions!

ryanto avatar Sep 07 '22 15:09 ryanto

We are using AWS parameter store. I assume that next-s3-upload API route acts like any other API route and should pick up the environment variables from the parameter store given that they are named according to the docs?

taylor-lindores-reeves avatar Sep 07 '22 15:09 taylor-lindores-reeves

Yup, it acts like any other API route in Next.js.

I'm not familiar with AWS parameter store, but as long as long as it sets the required ENV variables this library should pick them up.

ryanto avatar Sep 07 '22 16:09 ryanto

Environment variables behave strange when hosted outside of Vercel You might want to consider taking a look at this package and the nextjs examples provided in there https://github.com/andrewmclagan/react-env

OlivierJM avatar Sep 26 '22 07:09 OlivierJM

Hey I haven't heard back from you in a while. I'm going to close this issue, but feel free to comment if you think there's still a problem here!

ryanto avatar Nov 07 '22 14:11 ryanto