# confugu

> Awesome configs

Latest version **0.4.1** (published 2018-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install confugu
pnpm add confugu
yarn add confugu
bun add confugu
```

## 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.4.1 |
| Published | 2018-07-07 |
| First published | 2017-07-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Charlie Duong |
| Maintainers | austinkelleher, charlieduong94 |
| Keywords | config, environment, variables |

## Links

- npm: https://www.npmjs.com/package/confugu
- Repository: https://github.com/charlieduong94/confugu
- Homepage: https://github.com/charlieduong94/confugu#readme
- Issues: https://github.com/charlieduong94/confugu/issues
- npm.io page: https://npm.io/package/confugu

## Dependencies (3)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.12.0
- [traverse](https://npm.io/package/traverse.md) ^0.6.6
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2

## 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

- 0.4.1 (latest) — 2018-07-07
- 0.4.0 — 2018-01-15
- 0.3.0 — 2017-09-09
- 0.2.0 — 2017-09-08
- 0.1.0 — 2017-08-30
- 0.0.1 — 2017-07-19

## README

# confugu

Simple config loading with support for injecting environment variables.

### Installation

```
npm i confugu
```

### Usage

First, set up a `yaml` file to hold your config values.

```yaml
logLevel: debug

port: ${ HTTP_PORT } # use 'HTTP_PORT' environment variable
```

Next, just pass the path to your config file to the asynchronous `load` function.

```js
const confugu = require('confugu')

;(async () => {
  const config = await confugu.load('path/to/your/config')

  console.log(config.logLevel) // prints 'debug'
  console.log(config.port) // prints whatever is the value of process.env.HTTP_PORT
})()
```

Or you can load your config synchronously using `loadSync`:

```js
const confugu = require('confugu')

const config = confugu.loadSync('path/to/your/config')

console.log(config.logLevel) // prints 'debug'
console.log(config.port) // prints whatever is the value of process.env.HTTP_PORT
```

### Safely fetching nested properties

Fetching a nested property safely without having to check existence all the way
down the property chain is also supported using the `get` function:

```js
const confugu = require('confugu')

const config = confugu.loadSync('path/to/your/config')

console.log(config.get('logLevel')) // prints the value of the 'logLevel' property
console.log(config.get('db.password')) // prints the value of the 'db.password' property
console.log(config.get('invalid.nested.property')) // Invalid properties are "undefined"
```

### Running tests

```bash
npm test
```

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