backend: add MEET_COOKIE_SECURE env var for cookie security settings
This commit is contained in:
parent
98764597e2
commit
b2eb0b5439
@ -25,6 +25,7 @@ export const {
|
|||||||
MEET_API_KEY = '',
|
MEET_API_KEY = '',
|
||||||
MEET_ADMIN_USER = 'admin',
|
MEET_ADMIN_USER = 'admin',
|
||||||
MEET_ADMIN_SECRET = 'admin',
|
MEET_ADMIN_SECRET = 'admin',
|
||||||
|
MEET_COOKIE_SECURE = 'false',
|
||||||
|
|
||||||
// Token expiration times
|
// Token expiration times
|
||||||
MEET_ACCESS_TOKEN_EXPIRATION = '2h',
|
MEET_ACCESS_TOKEN_EXPIRATION = '2h',
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { CookieOptions } from 'express';
|
import { CookieOptions } from 'express';
|
||||||
import ms, { StringValue } from 'ms';
|
import ms, { StringValue } from 'ms';
|
||||||
|
import { MEET_COOKIE_SECURE } from '../environment.js';
|
||||||
|
|
||||||
export const getCookieOptions = (path: string, expiration: string): CookieOptions => {
|
export const getCookieOptions = (path: string, expiration: string): CookieOptions => {
|
||||||
return {
|
return {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: process.env.NODE_ENV === 'production',
|
secure: MEET_COOKIE_SECURE === 'true',
|
||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
maxAge: ms(expiration as StringValue),
|
maxAge: ms(expiration as StringValue),
|
||||||
path
|
path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user