string-env-interpolation
Use string interpolation to provide Environment Variables.
Installation
yarn add string-env-interpolation
npm install string-env-interpolation
Usage
Let's say we have a config file: config.yaml
.
debug: ${DEBUG:false}name: ${NAME:"Development"}user: ${USER}
Our library wants to be able to consume environment variables in index.js
.
;; ; console.logcontent;
Outputs:
DEBUG=true USER=kamil node index.js # Output debug: truename: Developmentuser: kamil NAME=Production USER=kamil node index.js # Output debug: falsename: Productionuser: kamil