How do environment variables work during build?
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
I have a GET route handler that gets executed during build time. This route makes a db call which uses environment variables to establish a connection. If the variables are not there the build falls. So what happens during build time? does nextjs load the variables from .env and execute the code? or does it hardcode my .env values into the build? Is it safe to build with my db credentials in .env?
1 Reply
Masai LionOP
from what I gather it is safe to include if I'm building on my machine, but maybe not so safe if I'm building a docker image?