Next.js Discord

Discord Forum

Environmental variables with multiple single-tenant stacks

Unanswered
Himalayan posted this in #help-forum
Open in Discord
HimalayanOP
Dealing with env variables seems pretty straightforward when there is a single environment, but is there any recommended way for dealing with multiple environments? I've seen [Environment Variable Load Order](https://nextjs.org/docs/app/guides/environment-variables#environment-variable-load-order) in the docs, but in there I can only have production, development or test. Is there any hidden option for pointing to specific .env.production.tenantX by any chance?

2 Replies

Burmese
it gives you a bit more control over the environment, and loading other files. You'd end up making your env flag something like prod-tenant1