Skip to content

Commit

Permalink
feat: add global flag to jwt options
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 29, 2023
1 parent 1ec9840 commit 36bbda5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/interfaces/jwt-module-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum JwtSecretRequestType {
}

export interface JwtModuleOptions {
global?: boolean;
signOptions?: jwt.SignOptions;
secret?: string | Buffer;
publicKey?: string | Buffer;
Expand All @@ -28,6 +29,7 @@ export interface JwtOptionsFactory {
}

export interface JwtModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
global?: boolean;
useExisting?: Type<JwtOptionsFactory>;
useClass?: Type<JwtOptionsFactory>;
useFactory?: (...args: any[]) => Promise<JwtModuleOptions> | JwtModuleOptions;
Expand Down
2 changes: 2 additions & 0 deletions lib/jwt.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ export class JwtModule {
static register(options: JwtModuleOptions): DynamicModule {
return {
module: JwtModule,
global: options.global,
providers: createJwtProvider(options)
};
}

static registerAsync(options: JwtModuleAsyncOptions): DynamicModule {
return {
module: JwtModule,
global: options.global,
imports: options.imports || [],
providers: this.createAsyncProviders(options)
};
Expand Down

0 comments on commit 36bbda5

Please sign in to comment.