backend: add MEET_COOKIE_SECURE env var for cookie security settings

This commit is contained in:
juancarmore 2025-06-24 18:36:17 +02:00
parent 98764597e2
commit b2eb0b5439
2 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ export const {
MEET_API_KEY = '',
MEET_ADMIN_USER = 'admin',
MEET_ADMIN_SECRET = 'admin',
MEET_COOKIE_SECURE = 'false',
// Token expiration times
MEET_ACCESS_TOKEN_EXPIRATION = '2h',

View File

@ -1,10 +1,11 @@
import { CookieOptions } from 'express';
import ms, { StringValue } from 'ms';
import { MEET_COOKIE_SECURE } from '../environment.js';
export const getCookieOptions = (path: string, expiration: string): CookieOptions => {
return {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
secure: MEET_COOKIE_SECURE === 'true',
sameSite: 'strict',
maxAge: ms(expiration as StringValue),
path