-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.module.ts
34 lines (32 loc) · 964 Bytes
/
app.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Logger, Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { DomainModule } from '@snipcode/domain';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import appConfig, { EnvironmentVariables, validate } from './configs/environment';
@Module({
controllers: [AppController],
imports: [
ConfigModule.forRoot({
envFilePath: ['.env.local', '.env.test'],
isGlobal: true,
load: [appConfig],
validate,
}),
DomainModule.forRootAsync({
inject: [ConfigService],
isGlobal: true,
useFactory: (configService: ConfigService<EnvironmentVariables, true>) => {
return {
convertKit: {
apiKey: '',
formId: '',
},
databaseUrl: configService.get('DATABASE_URL'),
};
},
}),
],
providers: [Logger, AppService],
})
export class AppModule {}