envparse
v1.1.0
Published
Parse environment variables to a deeply nested object
Downloads
2
Maintainers
Readme
This is a tiny library for NodeJS which parses environment variables and converts them into a deeply nested object.
index.js
var envparse = require('envparse')
console.log(envparse('TEST'))
$ TEST_user=bobby node index.js
{ user: "bobby" }
$ TEST_database_username=bla
$ TEST_database_password=morebla
$ node index.js
{ database: { username: "bla", password: "morebla" } }
API
envparse(opts)
Where opts
is an object containing:
- prefix: the prefix that will be searched for optional
If opts
is a string, it will use that string as a prefix.
License
The MIT License