Skip to content

Commit

Permalink
feat: read from GATSBY_ACTIVE_ENV by default (#98)
Browse files Browse the repository at this point in the history
https://www.gatsbyjs.org/docs/environment-variables/

GATSBY_ACTIVE_ENV is a quite new env variable, not very well documented imho. Setting it to staging will make gatsby read from .env.staging file for example
  • Loading branch information
slorber authored and mdreizin committed Jul 8, 2019
1 parent 063d3dc commit ebad741
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getOptions = pluginOptions => {

delete options.plugins;

const { env = {}, resolveEnv = () => process.env.NODE_ENV } = options;
const { env = {}, resolveEnv = () => process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV } = options;

const envOptions = env[resolveEnv()] || env[defaultEnv] || {};

Expand Down

0 comments on commit ebad741

Please sign in to comment.