# libconf

> Minimal config library for humans

Latest version **0.2.0** (published 2016-11-01) · MIT license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2016-11-01 |
| First published | 2016-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | niksrc |
| Maintainers | niksrc |
| Keywords | Config, env, Configuration, minimal |

## Links

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

## Dependencies (1)

- [ava](https://npm.io/package/ava.md) ^0.16.0

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2016-11-01
- 0.1.0 — 2016-10-31

## README

# libconf [![Build Status](https://travis-ci.org/niksrc/libconf.svg?branch=master)](https://travis-ci.org/niksrc/libconf)


> Minimal config library 

## Requirements
- node > 4

## Install

```
$ npm install --save libconf
```
## Loading
By default it searches in directory specified by `NODE_ENV` and fallback to `default` in case it doesn't find keys there. 
 
Default config dir is `config` which can be overriden by `NODE_ENV_CONFIG_DIR`.

```
❯ tree config
config
├── default
│   ├── app.js
│   └── db.js
├── dev
│   └── db.js
└── test
    └── db.js
```
## Usage

```js
const config = require('libconf');
config.getAll('db') 
/* 
	{ 
		mysql: {
			user: 'roottoor',
			password: 'secretsecret',
			host: 'http://locahost/mariadb',
			port: 1111
		}
	}
*/

config.get('db', 'mysql') 
/* 
	{
		user: 'roottoor',
		password: 'secretsecret',
		host: 'http://locahost/mariadb',
		port: 1111
	}
*/

config.has('db', 'mysql') // true
```


## API
All the methods fallback to default directory incase value in current config dir (`NODE_ENV`) is empty
### config.get(type, key)
Returns value of key in config  `type`
#### type

Type: `string`<br>

File in the config dir

#### key

Type: `string`<br>

Key to fetch in the file `type`

### config.has(type, key)
Checks if key exist in config  `type` returns boolean
#### type

Type: `string`<br>

File in the config dir

#### key

Type: `string`<br>

Key to check in the file `type`


### config.getAll(type)
Returns all keys in config `type`

#### type

Type: `string`<br>

File in the config dir

## License

MIT © [Nikhil Srivastava](https://niksrc.github.io)

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