New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jrosadob/ms-config

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jrosadob/ms-config

ms-config

  • 0.0.27
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@jrosadob/ms-config

npm version

Package dependencies

This package use:

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

How use

Install

$ npm i @jrosadob/ms-config

Sample .env file

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

# 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

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

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:

Keywords

FAQs

Package last updated on 30 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc