0.0.6 • Published 2 days ago

eris-env v0.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 days ago

Eris Env Loader

About package

ErisEnvLoader is a simple package that aims to simplify the initialization of environment variables from .env files in Node.js projects.

Installation

npm i eris-env

Usage

  • Create a .env file in the root folder of your project and define your environment variables in the format KEY=VALUE. For example:
DATABASE_DIALECT=postgres
DATABASE_HOST=localhost
DATABASE_PORT=5432
  • Create a config.js file in the root folder of your project and define package.
// ES6
import { ErisEnvLoader } from 'eris-env';
// CommonJS
const ErisEnvLoader = require('eris-env');

const envLoader = new ErisEnvLoader();
  • Initialize variable:
const config = {
  database: {
    dialect: envLoader.getEnv('string', 'DATABASE', 'DIALECT'),
    host: envLoader.getEnv('string', 'DATABASE', 'HOST'),
    port: envLoader.getEnv('number', 'DATABASE', 'PORT'),
  },
};
0.0.6

2 days ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago