Files
wwjcloud-nest-v1/wwjcloud/src/config/core/configModule.ts
2025-08-29 00:10:44 +08:00

38 lines
1.3 KiB
TypeScript

import { Module } from '@nestjs/common';
import { ConfigModule as NestConfigModule } from '@nestjs/config';
import { ConfigController } from '../controllers/configController';
import { ConfigCenterService } from '../services/configCenterService';
import { ConfigValidationService } from '../services/configValidationService';
import { DynamicConfigService } from '../services/dynamicConfigService';
import { DocsNavigationController } from '../controllers/docsNavigationController';
import { appConfig } from './appConfig';
import { SwaggerController } from '../modules/swagger/swaggerController';
import { SwaggerService } from '../modules/swagger/swaggerService';
@Module({
imports: [
NestConfigModule.forRoot({
isGlobal: true,
load: [() => appConfig],
envFilePath: ['.env.local', '.env.development', '.env.production', '.env'],
}),
],
controllers: [ConfigController, DocsNavigationController, SwaggerController],
providers: [
ConfigCenterService,
ConfigValidationService,
DynamicConfigService,
SwaggerService,
{
provide: 'APP_CONFIG',
useValue: appConfig,
},
],
exports: [
ConfigCenterService,
ConfigValidationService,
DynamicConfigService,
'APP_CONFIG',
],
})
export class ConfigModule {}