open-index/open-npm huggingface dataset:
npm package: @jrosadob/ms-config
Description: ms-config
Author: Javier A. Rosado Baltazar
Latest version: 0.0.27

# `@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:

```

```