Problem/Motivation
Local environment variables are not working when the .env-example file is copied as .env.
Steps to reproduce
1. Create a copy of the .env-example file and rename it .env
2. Change any or all of the environment variables
3. Run `npm run watch` - where the environment variables should take effect for Browsersync, but do not.
Proposed resolution
Install the NPM package `dotenv` in order to read from local environment variables
Remaining tasks
Install the NPM package `dotenv` in order to read from local environment variables
User interface changes
None
API changes
Install the NPM package `dotenv` in order to read from local environment variables
Data model changes
Install the NPM package `dotenv` in order to read from local environment variables
Issue fork prototype-3326929
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
philip_stier commented@jldust - This is ready for your review. I've installed https://www.npmjs.com/package/dotenv to load in variables into the process.env from the .env file. This will allow us to use local environment variables within the Gulp process.
To test, create a copy of the .example-env file and name it ".env". Once you run `npm run watch` Browsersync should pick up your local environment variables: `[Browsersync] Proxying: http://example.lndo.site`
Comment #4
philip_stier commentedComment #5
jldust commentedThis looks good, I was able to recreate it by following the steps above.
Comment #7
jldust commentedThanks for making the update, I've pulled in into the 4.x branch to be included with the next release version.
Comment #8
jldust commentedMarking this closed, it was included in the 4.0.0-alpha3 release. Thanks!