An open API service indexing awesome lists of open source software.

https://github.com/luizwbr/yaml-2-environment

Yaml file to environment variables
https://github.com/luizwbr/yaml-2-environment

environment-variables nodejs yaml yaml-parser

Last synced: 5 months ago
JSON representation

Yaml file to environment variables

Awesome Lists containing this project

README

          

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

## Usage

```javascript
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:
```yaml
base_url: google.com.br
```

```node
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.

```javascript
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.

```javascript
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' });