UNPKG

@nestjs/config

Version:

Configuration for NestJS: load .env files and custom configuration, validate it at startup, and read it through an injectable ConfigService.

21 lines (20 loc) • 732 B
import { ConfigModule } from '../index.js'; import { ConfigFactory } from '../interfaces/index.js'; import { ConfigObject } from '../types/index.js'; /** * @publicApi */ export interface ConfigFactoryKeyHost<T = unknown> { KEY: string | symbol; asProvider(): { imports: [ReturnType<typeof ConfigModule.forFeature>]; useFactory: (config: T) => T; inject: [string | symbol]; }; } /** * @publicApi * * Registers the configuration object behind a specified token. */ export declare function registerAs<TConfig extends ConfigObject, TFactory extends ConfigFactory = ConfigFactory<TConfig>>(token: string | symbol, configFactory: TFactory): TFactory & ConfigFactoryKeyHost<ReturnType<TFactory>>;