1.0.0 • Published 6 years ago

@brightcove-gs/odyssey-config v1.0.0

Weekly downloads
118
License
UNLICENSED
Repository
github
Last release
6 years ago

Odyssey Config

A configuration manager utilizing nconf

Install

yarn add @brightcove-gs/odyssey-config

Usage

const Config = require('@brightcove-gs/odyssey-config')

const defaults = {
  WWW_URL: 'https://www.example.com',
  IS_AWESOME: true,
  SCORE: 100,
  COLORS: ['red', 'green', 'blue'],
}

const config = Config(defaults)

config.get('IS_AWESOME') // => true

NOTES

  • Precedence

    1. Environment Variables trump all
    2. .env.json in the root directory takes second
    3. Passed in defaults object
  • Casting

    All values should have a default in the type they expect to be. For example, if you use a variable string WWW_URL = 'https://www.example.com'. You should declare a default value so it knows how to handle incoming environment variables.