1.3.1 • Published 6 years ago

@webacad/env v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

NPM version Build Status

WebACAD/Env

.env file loader written in typescript

Installation

$ npm install --save @webacad/env

or with yarn

$ yarn add @webacad/env

Usage

import {loadEnv} from '@webacad/env';

const env = loadEnv('path/to/.env');

Load env with schema

By default all values are returned as strings. This can be changed by providing schema where you can define returned types.

import {loadEnv} from '@webacad/env';

const env = loadEnv('path/to/.env', {
    NODE_ENV: {
    	type: 'string',
    	required: true,
    },
    SERVER_PORT: {
    	type: 'number',
    },
    SOURCE_MAPS: {
    	type: 'boolean',
    	default: true,
    },
});

Options:

  • type: "string", "number" or "boolean" (default: "string")
  • required: boolean (default: false)
  • default: any or function
1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago