# meshblu-config

> Meshblu Config from environment or JSON file

Latest version **9.0.2** (published 2017-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install meshblu-config
pnpm add meshblu-config
yarn add meshblu-config
bun add meshblu-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 | 9.0.2 |
| Published | 2017-08-10 |
| First published | 2015-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Octoblu Inc. |
| Maintainers | octoblu |
| Keywords | Meshblu |

## Links

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

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [fs-extra](https://npm.io/package/fs-extra.md) ^4.0.1
- [meshblu-encryption](https://npm.io/package/meshblu-encryption.md) ^3.0.1

## Recent versions

- 9.0.2 (latest) — 2017-08-10
- 9.0.1 — 2017-08-10
- 8.0.1 — 2017-06-02
- 8.0.0 — 2017-06-02
- 7.0.0 — 2017-03-14
- 6.4.3 — 2017-02-03
- 6.4.2 — 2017-02-03
- 6.4.1 — 2017-02-03
- 6.4.0 — 2017-02-03
- 6.3.0 — 2016-12-02
- 6.2.0 — 2016-12-02
- 6.1.0 — 2016-12-02
- 6.0.0 — 2016-08-16
- 5.2.0 — 2016-08-10
- 5.1.2 — 2016-06-27
- … 11 more at https://npm.io/package/meshblu-config/versions

## README

# meshblu-config
Meshblu Config from environment or JSON file

## Install

```bash
npm install meshblu-config
```

## Usage

```js
var MeshbluConfig = require('meshblu-config');
var meshbluConfig = new MeshbluConfig();
var config = meshbluConfig.generate({});

var Meshblu = require('meshblu');
var meshblu = Meshblu.createConnection(config);
```

## Options (showing default values)
# Functions
### Constructor
| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
| options   | object | no      | can contain any of these keys: envVars, defaultFilename, env |
------------------------------------------
```javascript
var meshbluConfig = new MeshbluConfig({envVars: {uuid: "MESHBLU_UUID", resolveSrv: "MESHBLU_RESOLVE_SRV"}})
var meshbluConfig = new MeshbluConfig({defaultFilename: './something-like-meshblu.json'})
var meshbluConfig = new MeshbluConfig({env: {"MESHBLU_UUID": "the-uuid"}})
```

### generate
Parse the default file, environment, and data and return the combined configuration

| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
| data       | object | no     | Data to process |
------------------------------------------
```javascript
var data = meshbluConfig.generate()
```

# Advanced Functions

### get
Returns the current config

| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
------------------------------------------
```javascript
var data = meshbluConfig.get();
```

### fromFile
Loads any values from the JSON file into the config

| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
| filename  | string | no     | JSON file to parse, defaults to ``./meshblu.json` |
------------------------------------------
```javascript
meshbluConfig.fromFile('./filename.json')
var data = meshbluConfig.get();
```

### fromEnv
Loads any values from the env

| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
| env       | object | no     | Environment to use, defaults to `process.env` |
------------------------------------------
```javascript
meshbluConfig.fromEnv({"MESHBLU_UUID": "the-uuid"})
var data = meshbluConfig.get();
```

### fromData
Loads any values from the env

| Parameter | Type   | Required| Description                          |
| ----------| -------| --------| -------------------------------------|
| data      | object | yes    | Data to use |
------------------------------------------
```javascript
meshbluConfig.fromData({uuid: "the-uuid"})
var data = meshbluConfig.get();
```

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