env2js
v1.0.5
Published
Add environment variables to config template file
Downloads
89
Readme
env2js
env2js is a straight forward way to add config settings to your frontend application using environment variables. This comes in especially handy when you are setting up your services for docker using environment variables and want to use the same variables for your app config.
Installing
npm install env2js
Running
node env2js --in infile.js --out outfile.js
Demo
export ENV=DEBUG
export DEBUG=1
create config.js
var config = {
debug: '{DEBUG}',
env: '{ENV}'
};
run
node env2js.js --in config.js --out config.out.js
result
var config = {
debug: '1',
env: 'DEBUG'
};