1.3.0 • Published 8 months ago

env-yml v1.3.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 months ago

Node Env YML

CI

Environment variable loader using yml files.

Installation

npm install env-yml

Usage

Declaring variables in a file (eg. .app.yml):

# Variables available in any environment
DATABASE_HOST: '127.0.0.1'
DATABASE_PORT: '5432'

# Variables available in development environment
development:
  DATABASE_USER: 'user-dev'

# Variables available in test environment
test:
  DATABASE_USER: 'user-test'

Reading the file:

const loadEnv = require('env-yml');

loadEnv();

console.log(process.env.DATABASE_HOST)
console.log(process.env.DATABASE_PORT)
console.log(process.env.DATABASE_USER)

Parameters

Optional configuration params:

namedescriptiondefault value
pathpath to yml file.app.yml
encodingencoding of yml fileutf8
envforce environment sectiondevelopment

Usage:

const loadEnv = require('env-yml');

loadEnv({
  path: 'myapp.yml',
  encoding: 'latin1',
  env: 'staging',
});
1.2.0

8 months ago

1.3.0

8 months ago

1.1.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago