Skip to content
This repository was archived by the owner on Jun 11, 2022. It is now read-only.

Commit 91e4d16

Browse files
authored
📚 integrated docs for Runtime Env
1 parent cae09e0 commit 91e4d16

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ Deploy React.js web apps generated with [create-react-app](https://github.com/fa
1515
* [Routing clean URLs](#routing-clean-urls)
1616
* [HTTPS-only](#https-only)
1717
* [Environment variables](#environment-variables)
18+
* [Set vars on Heroku](#set-vars-on-heroku)
19+
* [Set vars for local dev](#set-vars-for-local-dev)
20+
* [Compile-time vs Runtime](#compile-time-vs-runtime)
21+
* [Compile-time config](#compile-time-configuration)
22+
* [Runtime config](#runtime-configuration)
23+
* [using an Add-on's config](#add-on-config-vars)
1824
* 📍 [Version compatibility](#version-compatibility)
1925
* 🏙 [Architecture](#architecture-)
2026

@@ -147,21 +153,30 @@ Prevent downgrade attacks with [HTTP strict transport security](https://develope
147153

148154
### Environment variables
149155

150-
[`REACT_APP_*`](https://github.com/facebookincubator/create-react-app/blob/v0.2.3/template/README.md#adding-custom-environment-variables) environment variable are supported with this buildpack.
156+
[`REACT_APP_*` environment variables](https://github.com/facebookincubator/create-react-app/blob/v0.2.3/template/README.md#adding-custom-environment-variables) are supported with this buildpack.
151157

152158
🤐 *Be careful not to export secrets. These values may be accessed by anyone who can see the React app.*
153159

154-
Set [env vars on a Heroku app](https://devcenter.heroku.com/articles/config-vars) like this:
160+
##### [Set vars on Heroku](https://devcenter.heroku.com/articles/config-vars)
155161

156162
```bash
157163
heroku config:set REACT_APP_HELLO='I love sushi!'
158164
```
159165

160-
For local development, use [dotenv](https://www.npmjs.com/package/dotenv) to load variables from a `.env` file. *Requires at least create-react-app 0.7.*
166+
##### Set vars for local dev
167+
168+
*Requires at least create-react-app 0.7. Earlier versions only support Compile-time.*
169+
170+
Create a `.env` file that sets a variable per line:
171+
172+
```bash
173+
REACT_APP_API_URL=http://api.example.com
174+
REACT_APP_CLIENT_ID=XyzxYzxyZ
175+
```
161176

162177
#### Compile-time vs Runtime
163178

164-
Two versions of variables are supported. In addition to compile-time variables applied during [build](https://github.com/facebookincubator/create-react-app#npm-run-build), this buildpack supports runtime configuration as well.
179+
Two versions of variables are supported. In addition to compile-time variables applied during [build](https://github.com/facebookincubator/create-react-app#npm-run-build) the app supports variables set at runtime, applied as each web dyno starts-up.
165180

166181
Requirement | [Compile-time](#compile-time-configuration) | [Runtime](#runtime-configuration)
167182
:--- |:---:|:---:

0 commit comments

Comments
 (0)