# env2js Converts current env to js/json. Supports reading from `.env` files. - [env2js](#env2js) - [Usage](#usage) - [Versions](#versions) - [Linux](#linux) - [Windows](#windows) - [License](#license) ## Usage All commands are available via `env2js --help` ``` >$ env2js --help Converts your env to js or json file USAGE: env-to-json [OPTIONS] FLAGS: -h, --help Prints help information -V, --version Prints version information OPTIONS: -c, --config Sets a custom env file [default: .env] -g, --global Sets a custom global variable for javascript [default: __env] -p, --prefix Env variables prefix filter -t, --type Set output type [default: js] [possible values: js, json] ``` You can use it for making env variables available in runtime of your react app. ``` >$ REACT_APP_FOO=bar env2js -g env -p REACT_APP_ -t js > env.js ``` Will result in following file: ```js window.env = {"FOO":"bar"} ``` ## Versions ### Linux * env2js - simple build, without size optimizations * env2js.min - build with stripped symbols * env2js.nano - packed build with upx (seems upx on ubuntu is kinda broken, so this binary may be broken too) ### Windows * env2js.exe - windows build ## License [MIT](./LICENSE)