# @b-mo/config

> loads configuration based on the NODE_ENV

Latest version **0.7.0** (published 2021-02-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @b-mo/config
pnpm add @b-mo/config
yarn add @b-mo/config
bun add @b-mo/config
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2021-02-18 |
| First published | 2020-04-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tsteele |
| Maintainers | tsteele |

## Links

- npm: https://www.npmjs.com/package/@b-mo/config
- npm.io page: https://npm.io/package/@b-mo/config

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [@b-mo/es6-require](https://npm.io/package/@b-mo/es6-require.md) ^0.7.0

## Recent versions

- 0.7.0 (latest) — 2021-02-18
- 0.5.1 — 2020-09-18
- 0.5.0 — 2020-04-29

## README

# @b-mo/config

This package encapsulates our configuration loading algorithm. Its fairly basic:
given a directory load the `index.js` and `${NODE_ENV}.config.js` if they exist.

If either module is a function (async or sync) call it and merge the resulting object with then environment
configuration taking priority.


# Example usage
Say you have the following directory structure in your project
/root
  /config
   -index.js
   -test.config.js
   -production.config.js
   -develop.config.js

```
process.env.NODE_ENV='test'
import { load } from '@b-mo/onfig'

const config = await load(`root/config`)

console.log(config)
// Your test config
```

# API

```
const config = await load(directory)

directory - string - The directory to look for configs to load.
returns - a config object with the merged config values.
```

```
config.get(valuePath)

valuePath - string - attempt to get the value at the given path.
returns - the value in the config if found, otherwise it returns undefined.

```

```
config.has(valuePath)

valuePath - string - see if there is a value at the given path.
returns - true if the path exists false if it does not.

```

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