# @kingga/kc-config

> A configuration container for the kings collection.

Latest version **1.0.0** (published 2019-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kingga/kc-config
pnpm add @kingga/kc-config
yarn add @kingga/kc-config
bun add @kingga/kc-config
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-11-29 |
| First published | 2019-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Isaac Skelton |
| Maintainers | kingga |
| Keywords | Kings Collection, Configuration, Config, JavaScript, TypeScript |

## Links

- npm: https://www.npmjs.com/package/@kingga/kc-config
- Repository: https://github.com/kingga/kc-config
- npm.io page: https://npm.io/package/@kingga/kc-config

## Dependencies (3)

- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.13.1
- [@kingga/kc-container](https://npm.io/package/@kingga/kc-container.md) ^1.0.3

## 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.0 (latest) — 2019-11-29

## README

# Kings Collection Configuration Container
[![Build Status](https://travis-ci.com/kingga/kc-config.svg?branch=master)](https://travis-ci.com/kingga/kc-config)

A configuration container which can load configurations from multiple configuration file types. These include:

- JSON
- YAML
- DotEnv

## Installation
### Yarn
`yarn add @kingga/kc-config`

### NPM
`npm i @kingga/kc-config`

## Usage
```yaml
host: localhost
port: 999
user: root
pass: secret
database: db1
```

```ts
import Container from '@kingga/kc-container';
import ConfigServiceProvider, { IConfig } from '@kingga/kc-config';
import { resolve } from 'path';

const container = new Container();
const provider = new ConfigServiceProvider(container);
provider.register();

const config = container.make<IConfig>('IConfig');
config.loadFile(resolve(__dirname, './configs/db.yaml'));

// Some third party library.
db.createConnection({
    host: config.get('db.host', 'localhost'),
    port: config.get('db.port', 3306),
    user: config.get('db.user', 'root'),
    pass: config.get('db.pass', ''),
    database: config.get('db.database'),
});
```

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