# config-lib

> Simple configuration service for Azure DevOps variable replacement for different scopes.

Latest version **1.0.3** (published 2018-09-25) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install config-lib
pnpm add config-lib
yarn add config-lib
bun add config-lib
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-09-25 |
| First published | 2018-09-25 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Corey Yates |
| Maintainers | shortcircuit21 |
| Keywords | Angular, VSTS, configuration |

## Links

- npm: https://www.npmjs.com/package/config-lib
- npm.io page: https://npm.io/package/config-lib

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.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.3 (latest) — 2018-09-25
- 1.0.2 — 2018-09-25
- 1.0.0 — 2018-09-25

## README

# VSTS Configuration Service

Service loads your configuration on application initialization when calling loadConfig(). Allows you to have the ability to use Azure DevOps' token replacement with Angular project releases in different scopes.

## Install

```bash
npm i config-lib
```

## Usage

Import App.Module.ts:

```bash
import { ConfigLibService } from "config-lib";
```

Under providers:

```bash
{
    'provide': APP_INITIALIZER,
    'useFactory': init,
    'deps': [ConfigLibService],
    'multi': true
},
    ConfigLibService
```

Still in App.Module.ts under export class AppModule() { }

```bash
export function init(configService: ConfigLibService) {
  return () => configService.loadConfig();
}
```

This will set the config string on application initialization to be used later.

Create a client-config.json file under your assets folder.

```bash
{
    "url": "https://example.com"
}
```

In any component/service you can call the ConfigLibService.configuration for the whole json configuration or ConfigLibService.getConfig("key") for a specific configuration value.

Finally add: "src/assets/client-config.json" under "assets" in the angular.json file.

## License

[MIT](http://vjpr.mit-license.org)

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