# mr-config

> Merges configurations from multiple files, as specified in the MR_CONFIGS_FILES environment variable. Allowing for easy loading of environmental configurations.

Latest version **1.0.1** (published 2015-09-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install mr-config
pnpm add mr-config
yarn add mr-config
bun add mr-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 | 1.0.1 |
| Published | 2015-09-29 |
| First published | 2015-09-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+13 in 2 direct dependencies) |
| Install scripts | no |
| Author | NiteHogg |
| Maintainers | nitehogg |
| Keywords | config, configuration, environment |

## Links

- npm: https://www.npmjs.com/package/mr-config
- Repository: https://github.com/techniboogie/mr-config
- Issues: https://github.com/techniboogie/mr-config/issues
- npm.io page: https://npm.io/package/mr-config

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) 3.10.1
- [js-yaml](https://npm.io/package/js-yaml.md) 3.4.0
- [jsonfile](https://npm.io/package/jsonfile.md) 2.2.1
- [xml2json](https://npm.io/package/xml2json.md) 0.9.0
- [properties-parser](https://npm.io/package/properties-parser.md) 0.3.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-09-29
- 1.0.0 — 2015-09-29

## README

Merges configurations from multiple files, as specified in the MR_CONFIGS_FILES environment variable. Allowing for easy loading of environmental configurations.

```js
// apps.js
var config = require('mr-config');

// service.js
// Uses a cached copy of the configuration
var config = require('mr-config');
```

```bash
# config files are merged together. The right-most files
# will override existing duplicate properties.
MR_CONFIGS_FILES="/home/user/app-config.json, /home/user/db-config.json" node app.js
```

## Installation
```bash
npm install mr-config
```

## API
##### config.$configs | *Array*
The values retrieved from MR_CONFIGS_FILES
```js
var confFiles = config.$configs
// [ 'app-config.json', 'db-config.json' ]
```
___
##### config.$timestamp | *Number*
The milliseconds since the epoch
```js
var lastLoadTime = config.$timestamp
// 1443498715071
```
___
##### config.reload( [parser] )
Forces of reload of all config files into memory.
```js
config.reload();
// Reloads config in place
```
If a custom parser is needed, reload() can be invoked with a function.
```js
config.reload(function(filePath) {
  /*
   * Do Stuff
   */
  return object;
});
```
___
##### config.watch()
Creates a file system watcher for each configuration file
```js
config.watch()
// Will reload config in memory if any of the files change
```
___
##### config.unwatch()
Closes and config file watchers
```js
config.unwatch()
// Undoes the watch
```

## Change Log
##### 1.0.0
* First release

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