Skip to content

luizwbr/yaml-2-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yaml-2-environment

Yaml file to environment variables. Based on https://github.com/jrwells/env-yaml

Usage

require('yaml-2-environment').config();

It loads a .env.yml file in the root directory of your project, and parses to add as environment variables.

Example:

base_url: google.com.br
process.env.base_url: 'google.com.br'

Options

Path

Default: .env.yml

You can specify a custom path if your file containing environmnet variables is named or located differently.

require('yaml-2-environment').config({ path: '/custom/path/to/your/yaml/env/vars' });

Encoding

Default: utf8

You may specify the encoding of your file containing environment variables using this option.

require('yaml-2-environment').config({ encoding: 'base64' });

Namespace

Default: null

You may specify a namespace in which to fetch your environment variables. Useful when you want to store environment specific values within the same files.

require('yaml-2-environment').config({ namespace: 'development' });