Skip to content

Commit 9dc9995

Browse files
committed
Added new env var to base builds on.
1 parent 21b59b7 commit 9dc9995

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.circleci/config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ jobs:
119119
docker:
120120
- image: *build-image
121121
working_directory: *workspace
122+
parameters:
123+
config:
124+
description: |
125+
The config file you want to build the app using.
126+
E.g. 'development' would load configurations from 'config/development.json'
127+
type: enum
128+
enum: ["development", "staging", "production"]
129+
default: production
122130
steps: # steps that comprise the `build` job
123131
- attach_workspace:
124132
at: *workspace
@@ -131,7 +139,7 @@ jobs:
131139
name: Build static side
132140
command: |
133141
yarn
134-
yarn build
142+
REACT_APP_CONFIG=<< parameters.config >> yarn build
135143
136144
- persist_to_workspace:
137145
root: /home/circleci/project

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import InfoPanel from "./components/Info";
77

88
// Set config based on the environment variable the build was run under.
99
let config = {};
10-
if (process.env.NODE_ENV === "production") {
10+
if (process.env.REACT_APP_CONFIG === "production") {
1111
config = require("./config/production.json");
12-
} else if (process.env.NODE_ENV === "staging") {
12+
} else if (process.env.REACT_APP_CONFIG === "staging") {
1313
config = require("./config/staging.json");
1414
} else {
1515
config = require("./config/development.json");

0 commit comments

Comments
 (0)