@fidilen/env
v2.2.0
Published
Easy-to-use configuration system for environment variables. Acts as subtitute for .env files if you don't want to update .env from time to time, or if you need to expose variables, but not .env.
Downloads
2
Readme
config
Easy-to-use configuration system for environment variables.
The main goal of this is to save projects from using process.env
while keeping the convenience of referencing the variables across a project.
Setup
- New folder
env
in the root directory. - New
env.json
under theenv
folder. - Set
ENV
as eitherdev
,prod
, or any other keyword.- Create a new JSON file in the same directory with suffix after the keyword (eg.
env-dev.json
) - Otherwise, default config is the
env.json
- Create a new JSON file in the same directory with suffix after the keyword (eg.
Note: You should add
env
in your.gitignore
if you don't want to have these included in your commits.
Examples
env.json
{
"ENV": "dev"
}
env-dev.json
{
"VARIABLE_NAME": "123"
}
Usage
const config = require('@fidilen/config');
console.log(config.VARIABLE_NAME);