@papertray3/cf-express-config
Config module for express server components
Last updated a year ago by papertray3 .
MIT · Original npm · Tarball · package.json
$ cnpm install @papertray3/cf-express-config 
SYNC missed versions from official npm registry.

CF Express Config

A simple package that combines several features for easy configuration of an Express server with support for Cloud Foundry (VCAP) Services.

This package combines several useful packages that allow you to easily provide different ways to configure your express server (or any other Node.js application) via environment files, command line options or environment variables.

Installation

npm i --save @papertray3/cf-express-config

Feautures

Uses the following packages to provide a configuration context:

  • nconf: Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.
  • dotenv: Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env.
  • yargs: Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
  • cfenv: The cfenv package provides functions to parse Cloud Foundry-provided environment variables.

API

The module exports one function: configure which takes a ConfigOptions object and returns a configured nconf object:

export interface ConfigOptions {
    version?: string,
    envPath?: string, // path to the .env file for dotenv, otherwise './.env'
    vcapPath?: string, // local definition of vcap services, default of './vcap-local.js'
    usage?: string,
    cliOptions?: CliOptions,
    overrides?: ConfigOverrides
}

CliOptions contain any command line arguments and are yargs options with the additon of an env key which can be either a string or an array of strings which are specific environment variable names that will fill in the option if it exists.

ConfigOverrides is an object that contains key/value pairs that set values to always be the given value.

Current Tags

  • 3.2.1                                ...           latest (a year ago)

9 Versions

  • 3.2.1                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |