Export environment variables to a json or javascript file
One use case for this small cli tool is to enable runtime variables when deploying a create-react-app web-app with Docker. The idea consists in using a env.js
script included from index.html
. This script sets the window._env
property with environment variables. However, this script must be created during start up of your docker container.
With envexp
tool you can create the env.js
script easily before start serving your web-app.
Fore more details read this issue.
./envexp -t json > env.json
./envexp -t web > env.js
./envexp -t json -prefix REACT_APP_ > env.json
./envexp -t web -prefix REACT_APP_ > env.js
./envexp -p -t json > env.json
./envexp -p -t web > env.js