From 25c04ced2fc38ab0cedc29a2b1f4bc571b77fd88 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:04:01 -0500 Subject: [PATCH] add JWT_SECRET fallback, remove env_file from compose --- backend/src/auth/auth.module.ts | 2 +- backend/src/auth/jwt.strategy.ts | 2 +- docker-compose.yml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/auth/auth.module.ts b/backend/src/auth/auth.module.ts index 62c7da7..f2f29d7 100644 --- a/backend/src/auth/auth.module.ts +++ b/backend/src/auth/auth.module.ts @@ -13,7 +13,7 @@ import { JwtStrategy } from './jwt.strategy'; imports: [ConfigModule], inject: [ConfigService], useFactory: (config: ConfigService) => ({ - secret: config.get('JWT_SECRET'), + secret: config.get('JWT_SECRET') || 'dev-secret', signOptions: { expiresIn: '7d' }, }), }), diff --git a/backend/src/auth/jwt.strategy.ts b/backend/src/auth/jwt.strategy.ts index ce5c0c4..c1d6515 100644 --- a/backend/src/auth/jwt.strategy.ts +++ b/backend/src/auth/jwt.strategy.ts @@ -13,7 +13,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), ignoreExpiration: false, - secretOrKey: config.get('JWT_SECRET')!, + secretOrKey: config.get('JWT_SECRET') || 'dev-secret', }); } diff --git a/docker-compose.yml b/docker-compose.yml index 5f7414e..1fc9275 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,6 @@ services: build: ./backend ports: - '3000:3000' - env_file: .env admin: build: ./admin