0.1.1 • Published 4 years ago

nestjs-dynamic-config v0.1.1

Weekly downloads
35
License
MIT
Repository
github
Last release
4 years ago

Nest.js Dynamic Configuration Module

This module allows to automatically watch & reload configuration in runtime. For instance, Nest.js server may be used together with Vault Agent on Kubernetes and this module allows to continuously reload secrets file mounted in attached volume.

import { DynamicConfigModule } from 'nestjs-dynamic-config';

const onError = (error: Error) => {
  appLogger.error(error.message, error.stack, 'Config');
  process.exit(1);
};

export const ConfigModule = DynamicConfigModule.forRoot({
  logger: appLogger,
  source: DynamicConfigSource.FILE,
  configFilePath: process.env['CONFIG_FILE'], // 
  watchForChanges: !isTestEnv(), // Chokidar causes Jest to leak memory in tests.
  onError,
  parseConfig,
});