Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using specific dotenv file according to environment #8331

Closed
fralonra opened this issue Nov 11, 2020 · 5 comments
Closed

Support using specific dotenv file according to environment #8331

fralonra opened this issue Nov 11, 2020 · 5 comments

Comments

@fralonra
Copy link

Is your feature request related to a problem? Please describe.

Currently it seems that we can use only one dotenv file (.env, see load.js) in the project. But sometimes we need to have different dotenv in one project and can use them for different environment.

Describe the solution you'd like

Load dotenv file according to current environment.
eg. .env.dev or .env.development for development, and .env.prod or .env.production for production, and .env for default.

@danielroe
Copy link
Member

danielroe commented Nov 15, 2020

@fralonra You can specify the .env file to load on the command line e.g. yarn nuxt --dotenv .env.staging - which should give you the flexibility you might want. This works for both env and runtimeConfig.

@nirazul
Copy link

nirazul commented Sep 2, 2022

Currently, this doesn't seem to work with Nuxt 3 (rc8)

@daviddomain
Copy link
Contributor

No luck as well. Using nuxt/bridge-edge nuxi dev --dotenv .env.whatever does not load the correct environment variables.

@nidmidhalf
Copy link

@danielroe Any update on this? nuxt.config.ts is always picking the environment variables from .env instead of .env.development inspite of mentioning the --dotenv .env.development in package.json

Copy link
Member

Feel free to create an issue with a reproduction 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants