Next.js Discord

Discord Forum

Use of variant .env file (HELP)

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I have to use multiple env file based on the servers, (uat ,production and local) the uat server serves like as local but need to use the uat env file while production and local uses respective env file. How can i solve this?

1 Reply

Burmese
default @next/env behaviour is not very flexible, as it only considers development, production, and test to be valid environments, and is controlled by whether you run next dev or next build, or set NODE_ENV=test.

But I just released an drop-in replacement (open source) which would allow you load specific .env.XXX files

https://varlock.dev/integrations/nextjs/