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

Command icon 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

philip_stier created an issue. See original summary.

philip_stier’s picture

@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`

philip_stier’s picture

Status: Active » Needs review
jldust’s picture

Status: Needs review » Reviewed & tested by the community

This looks good, I was able to recreate it by following the steps above.

jldust’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for making the update, I've pulled in into the 4.x branch to be included with the next release version.

jldust’s picture

Status: Fixed » Closed (fixed)

Marking this closed, it was included in the 4.0.0-alpha3 release. Thanks!