# @papertray3/cf-express-config

> Config module for express server components

Latest version **3.2.1** (published 2019-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @papertray3/cf-express-config
pnpm add @papertray3/cf-express-config
yarn add @papertray3/cf-express-config
bun add @papertray3/cf-express-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2019-06-17 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Sean Thatcher |
| Maintainers | papertray3 |

## Links

- npm: https://www.npmjs.com/package/@papertray3/cf-express-config
- npm.io page: https://npm.io/package/@papertray3/cf-express-config

## Dependencies (8)

- [cfenv](https://npm.io/package/cfenv.md) ^1.2.2
- [nconf](https://npm.io/package/nconf.md) ^0.10.0
- [yargs](https://npm.io/package/yargs.md) ^13.2.2
- [dotenv](https://npm.io/package/dotenv.md) ^8.0.0
- [@types/node](https://npm.io/package/@types/node.md) ^12.0.0
- [@types/nconf](https://npm.io/package/@types/nconf.md) ^0.10.0
- [@types/yargs](https://npm.io/package/@types/yargs.md) ^13.0.0
- [@types/dotenv](https://npm.io/package/@types/dotenv.md) ^6.1.1

## Recent versions

- 3.2.1 (latest) — 2019-06-17
- 3.2.0 — 2019-06-17
- 3.1.1 — 2019-05-23
- 3.1.0 — 2019-05-22
- 3.0.0 — 2019-05-21
- 2.0.3 — 2019-05-21
- 2.0.2 — 2019-05-15
- 2.0.1 — 2019-05-15
- 2.0.0 — 2019-05-04

## README

# 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
```(shell) 
npm i --save @papertray3/cf-express-config
```

## Feautures
Uses the following packages to provide a configuration context:
* [nconf](https://www.npmjs.com/package/nconf): Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.
* [dotenv](https://www.npmjs.com/package/dotenv): Dotenv is a zero-dependency module that loads environment variables from a .env file into `process.env`.
* [yargs](https://www.npmjs.com/package/yargs): Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
* [cfenv](https://www.npmjs.com/package/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:

```(ts)
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.

---
_Source: https://npm.io/package/@papertray3/cf-express-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
