项目作者: luizwbr

项目描述 :
Yaml file to environment variables
高级语言: JavaScript
项目地址: git://github.com/luizwbr/yaml-2-environment.git
创建时间: 2019-09-11T12:05:12Z
项目社区:https://github.com/luizwbr/yaml-2-environment

开源协议:GNU General Public License v3.0

下载


yaml-2-environment

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

Usage

  1. 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:

  1. base_url: google.com.br
  1. 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.

  1. 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.

  1. 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.

```javascript
require(‘yaml-2-environment’).config({ namespace: ‘development’ });