Run "gatsby develop" with a specific file of environment variables #33097
Unanswered
robertocerdasilva
asked this question in
Help
Replies: 1 comment
-
Hi! You could use an environment variable to define this. So when you run: STAGING=true gatsby develop Then In your if (process.env.STAGING) {
require("dotenv").config({
path: `.env.staging`,
})
} else {
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a question.
I have 2 files with environment variables:
When I execute the command
gatsby develop
by default it takes the value of the environment variables that are in the file ".env.development". That's fine...The question is: Is it possible through the
gatsby develop
command to consider the value of the environment variables that exist in ".env.staging" and not in ".env.development"?I need to test in development and currently I have to manually modify the environment variables in ".env.development".
Thanks!!! :D
Beta Was this translation helpful? Give feedback.
All reactions