yaml-env-load
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

yaml-env-load

NPM version

Loads config from yaml file to process.env. Unlike other packages, env can store objects.

Install

# with npm
npm install yaml-env-load

# or with Yarn
yarn add yaml-env-load

Usage

const config = require('yaml-env-load')
config('.env.yaml') // if no path is given, it defaults to .env 

env.yaml

NODE_ENV: production
db:
  host: localhost
  port: 27017

process.env now has the keys and values you defined in your .env.yaml file.

console.log(process.env.db) // returns { host: 'localhost', port: 27017 } AS OBJECT
console.log(process.env.NODE_ENV) // returns production AS STRING

/yaml-env-load/

    Package Sidebar

    Install

    npm i yaml-env-load

    Weekly Downloads

    142

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    4.11 kB

    Total Files

    7

    Last publish

    Collaborators

    • erdemefe07