# @jrosadob/ms-config

> ms-config

Latest version **0.0.27** (published 2024-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jrosadob/ms-config
pnpm add @jrosadob/ms-config
yarn add @jrosadob/ms-config
bun add @jrosadob/ms-config
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.27 |
| Published | 2024-04-30 |
| First published | 2023-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 95.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Javier A. Rosado Baltazar |
| Maintainers | jrosadob |
| Keywords | Cloud Config Client, ms-config, nestjs |

## Links

- npm: https://www.npmjs.com/package/@jrosadob/ms-config
- npm.io page: https://npm.io/package/@jrosadob/ms-config

## Dependencies (2)

- [@nestjs/config](https://npm.io/package/@nestjs/config.md) ^3.2.2
- [cloud-config-client](https://npm.io/package/cloud-config-client.md) ^1.6.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.0.27 (latest) — 2024-04-30
- 0.0.26 — 2024-04-28
- 0.0.25 — 2024-04-28
- 0.0.24 — 2024-04-28
- 0.0.23 — 2024-04-28
- 0.0.22 — 2024-04-28
- 0.0.21 — 2024-04-28
- 0.0.20 — 2024-04-28
- 0.0.19 — 2024-04-28
- 0.0.18 — 2024-04-28
- 0.0.17 — 2024-04-25
- 0.0.16 — 2024-04-23
- 0.0.15 — 2024-04-23
- 0.0.14 — 2024-04-23
- 0.0.12 — 2024-04-21
- … 7 more at https://npm.io/package/@jrosadob/ms-config/versions

## README

# `@jrosadob/ms-config`

[![npm version](https://badge.fury.io/js/@jrosadob%2Fms-config.svg)](https://badge.fury.io/js/@jrosadob%2Fms-config)

## Package dependencies

This package use:

```sh
$ npm i cloud-config-client
$ npm i @nestjs/config
```

## How use

### Install

```sh
$ npm i @jrosadob/ms-config
```

### Sample `.env` file

The rest of the configuration should be on the configuration server in yml format.

```sh
# Endpoint Config Server (Mandatory)
ENDPOINT=http://localhost:8901
# Application name (Mandatory)
CONFIG=ms-auth
# Environment (Optional)
LABEL=development
```

### Use in main.ts

This sample show how use ConfigServer in main.ts

```ts
import { NestFactory } from '@nestjs/core'
import { Logger } from '@nestjs/common'
import { ConfigService, LoadConfig } from '@jrosadob/ms-config'
import { AppModule } from './app.module'

async function bootstrap() {
  const configService = await LoadConfig()
  const environment = configService.get('NODE_ENV').toUpperCase()
  const nameApp = configService.getServer('app.name')
  const portTcp = +configService.getServer('app.portTcp')
  const portHttp = +configService.getServer('app.portHttp')

  const app = await NestFactory.create(AppModule)
  await app.startAllMicroservices()
  await app.listen(portHttp)

  Logger.log(
    `Microservice ${nameApp}: HTTP(s) Listening on http://localhost:${portHttp}`,
    'Bootstrap',
  )
  Logger.log(`Environment: ${environment}`, 'Bootstrap')
}

bootstrap()
```

### Use in app.module.ts

Only, if ConfigService is used in main.ts

```ts
import { Module } from '@nestjs/common'
import { ConfigService } from '@jrosadob/ms-config'

@Module({
  imports: [],
  controllers: [],
  providers: [ConfigService],
})
export class AppModule {}
```

If not use ConfigService in main.ts, your app.modele.ts shoudlbe:

```

```

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