feat: added secure cookie env

Signed-off-by: Varun Raj <mailme@varunraj.in>
This commit is contained in:
Varun Raj committed 2024-09-07 19:37:18 +05:30
1 parent bcb12473e0
commit 23c341cba5
4 files changed
+8 -3

No files matched your search

+2 -2
View File
@@ -1,3 +1,4 @@
import { ENV } from '@/config/environment'
import type { CookieSerializeOptions } from 'cookie'
import cookie from 'cookie'
import type { IncomingMessage } from 'http'
@@ -22,8 +23,7 @@ export const serializeCookie = (
return cookie.serialize(name, String(value), {
httpOnly: true,
maxAge: 60 * 60 * 24 * 7,
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
secure: process.env.NODE_ENV === 'production',
secure: ENV.SECURE_COOKIE,
path: '/',
...options,
})