All Projects β†’ mars β†’ Heroku Js Runtime Env

mars / Heroku Js Runtime Env

Licence: mit
Runtime env var support for static javascript apps on Heroku

Programming Languages

javascript
184084 projects - #8 most used programming language

Heroku JS Runtime Env

Use runtime environment variables in bundled/minified javascript apps.

Build Status npm Module

Usage

Designed for create-react-app-buildpack. See its documentation to use this module for Runtime configuration.

See also πŸ”¬πŸš§ experimental, generalized usage with heroku-js-runtime-env-buildpack.

Background

Normally javascript apps are compiled into a bundle before being deployed. During this build phase, environment variables may be embedded in the javascript bundle, such as with Webpack DefinePlugin.

When hosting on a 12-factor platform like Heroku, these embedded values may go stale when setting new config vars or promoting through a pipeline.

How Does It Work?

When developing your app, use Runtime environment variables from create-react-app-buildpack.

Then, each time the app starts-up on Heroku, a .profile.d script (installed from the buildpack) is executed which fills in a JSON placeholder in the JavaScript bundle with the runtime environment variables. The result is πŸƒfresh runtime environment variables in the production javascript bundle without recompiling.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].