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
- Host: GitHub
- URL: https://github.com/luizwbr/yaml-2-environment
- Owner: luizwbr
- License: gpl-3.0
- Created: 2019-09-11T12:05:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-11-16T21:33:40.000Z (7 months ago)
- Last Synced: 2025-11-16T23:20:19.929Z (7 months ago)
- Topics: environment-variables, nodejs, yaml, yaml-parser
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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' });