Skip to content

Commit c5c2939

Browse files
Merge pull request #955 from flamewow/feat/plain_module_import
feat(): JWT_MODULE_OPTIONS set to be optional
2 parents 3fcead1 + 78c9bb3 commit c5c2939

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/jwt.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import { Inject, Injectable, Logger } from '@nestjs/common';
1+
import { Inject, Injectable, Logger, Optional } from '@nestjs/common';
22
import * as jwt from 'jsonwebtoken';
33
import {
44
JwtModuleOptions,
55
JwtSecretRequestType,
66
JwtSignOptions,
77
JwtVerifyOptions
8-
} from './interfaces/jwt-module-options.interface';
8+
} from './interfaces';
99
import { JWT_MODULE_OPTIONS } from './jwt.constants';
1010

1111
@Injectable()
1212
export class JwtService {
1313
private readonly logger = new Logger('JwtService');
1414

1515
constructor(
16-
@Inject(JWT_MODULE_OPTIONS) private readonly options: JwtModuleOptions
16+
@Optional()
17+
@Inject(JWT_MODULE_OPTIONS)
18+
private readonly options: JwtModuleOptions = {}
1719
) {}
1820

1921
sign(payload: string | Buffer | object, options?: JwtSignOptions): string {

0 commit comments

Comments
 (0)