Created
January 23, 2022 11:28
-
-
Save zzpzaf/27ce9f2847ce01952e510ff70d1edb3c to your computer and use it in GitHub Desktop.
Unexpected behavior when getting a value from .env file for expireIn property - auth.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth.module.ts | |
import { forwardRef, Module } from '@nestjs/common'; | |
import { ConfigService } from '@nestjs/config'; | |
import { JwtModule } from '@nestjs/jwt'; | |
import { UsersModule } from 'src/users/users.module'; | |
import { AuthController } from './auth.controller'; | |
import { AuthService } from './auth.service'; | |
@Module({ | |
imports: [ | |
forwardRef(() => UsersModule), | |
JwtModule.registerAsync({ | |
// imports: [ConfigModule], | |
inject: [ConfigService], | |
useFactory: async (configService: ConfigService) => ({ | |
secret: configService.get('JWT_SECRET'), | |
signOptions: { | |
expiresIn: configService.get<number>('JWT_EXP_H', 60), | |
}, | |
}), | |
}), | |
], | |
controllers: [AuthController], | |
providers: [AuthService], | |
exports: [JwtModule], | |
}) | |
export class AuthModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment