app.module.ts
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true
}),
MongooseModule.forRoot(process.env.MONGO_DB_URI, {useFindAndModify: false}),
UsersModule,
RolesModule,
AuthenticationModule,
TwoFactorAuthModule,
RememberPasswordModule,
RegistrationLinkModule
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
authentication.module.ts
@Module({
imports: [
JwtModule.register({
secret: process.env.JWT_SECRET
}),
UsersModule,
TwoFactorAuthModule,
RememberPasswordModule,
RegistrationLinkModule
],
controllers: [AuthenticationController],
providers: [AuthenticationService]
})
export class AuthenticationModule {}
In AuthenticationModule process.env is undefined. But if I use it in AuthenticationService it works fine. How can I use process.env in module file?