@tkesgar/reno
You think they're big too? They really get in the way...
reno is a library to work with environment variables.
Installation
npm install @tkesgar/reno
Usage
loadEnv(opts?)
Loads the following env files in order:
- Local env (
.env
) - Local environment env (e.g.
production.local.env
) - Environment env (e.g.
production.env
) - Default env (e.g.
default.env
)
reno internally uses dotenv. If an env file does not exist it will skipped, and any environment variables specified earlier will not be overridden.
Environment name is determined from opts.env
(defaults to the value of
NODE_ENV
). If opts.env
is null
, environment env files will be skipped.
*.local.env
can be skipped by setting opts.loadLocalEnv
to false
.
The default env file name is specified by opts.default
(defaults to
default.env
).
getEnv(): string
Returns the value of NODE_ENV
. Defaults to "development"
if NODE_ENV
environment variable is not set.
isDevelopment(): boolean
Alias to getEnv() === "development"
.
isProduction(): boolean
Alias to getEnv() === "production"
.
Contributing
Feel free to submit issues and create pull requests.
License
Licensed under MIT License.