next-s3-upload
next-s3-upload copied to clipboard
Where to store environment variables with client-side env store?
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?
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!
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?
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.
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
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!