add JWT_SECRET fallback, remove env_file from compose
This commit is contained in:
@@ -13,7 +13,7 @@ import { JwtStrategy } from './jwt.strategy';
|
|||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
useFactory: (config: ConfigService) => ({
|
useFactory: (config: ConfigService) => ({
|
||||||
secret: config.get<string>('JWT_SECRET'),
|
secret: config.get<string>('JWT_SECRET') || 'dev-secret',
|
||||||
signOptions: { expiresIn: '7d' },
|
signOptions: { expiresIn: '7d' },
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
|||||||
super({
|
super({
|
||||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
ignoreExpiration: false,
|
ignoreExpiration: false,
|
||||||
secretOrKey: config.get<string>('JWT_SECRET')!,
|
secretOrKey: config.get<string>('JWT_SECRET') || 'dev-secret',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ services:
|
|||||||
build: ./backend
|
build: ./backend
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
env_file: .env
|
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
build: ./admin
|
build: ./admin
|
||||||
|
|||||||
Reference in New Issue
Block a user