Page MenuHomePhabricator

Define `NODE_ENV` and always define `NODE_PATH`
ClosedPublic

Authored by dduvall on Aug 23 2017, 6:14 PM.

Details

Maniphest Tasks
T174626: Optimized image builds for node applications
Reviewers
thcipriani
mobrovac
mmodell
Group Reviewers
Release-Engineering-Team
Commits
rGBLBR2a19f04679b0: Define `NODE_ENV` and always define `NODE_PATH`
Patch without arc
git checkout -b D759 && curl -L https://phabricator.wikimedia.org/D759?download=true | git apply
Summary

Define NODE_ENV based on the configuration and define NODE_PATH when
either npm.install or npm.env are true. The latter behavior is
necessary for final stages of multi-stage builds where npm modules are
not installed but the application requires node-related environment
variables to run.

Depends on D757
Ref T174626

Rename npm module/config to node

Renamed npm yaml entry to node and NpmConfig to NodeConfig.
Since we're dealing with general node builds and configuration, this
seems to make more sense.

Test Plan

Run go test ./... or arc unit. Run blubber against at least the
blubber.example.yaml.

Diff Detail

Repository
rGBLBR Blubber
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript

For testing and development, NODE_ENV should probably be set to development, but I don't see it being set, i.e. if we are not in a production setting, it's safe to assume we are in development mode :)

Rebased and modified to reflect changes in D756

For testing and development, NODE_ENV should probably be set to development, but I don't see it being set, i.e. if we are not in a production setting, it's safe to assume we are in development mode :)

Blubber will just set up a NODE_ENV environment variable for whatever you've set the node.env yaml config to, so it's up to you to set it according to your needs at the root level of the config or for a specific variant.

This revision is now accepted and ready to land.Sep 6 2017, 11:02 PM
This revision was automatically updated to reflect the committed changes.