fix: dropped unnecessary .env vars (frontend)

This commit is contained in:
ae 2025-05-09 15:12:47 +03:00
parent ae3c0e6c0c
commit 4625720588
Signed by: ae
GPG Key ID: 995EFD5C1B532B3E
2 changed files with 3 additions and 7 deletions

View File

@ -13,11 +13,9 @@ ADMIN_PASSWORD=""
ACCOUNT_CREATION_ENABLED="0"
LOG_LEVEL="info"
APP_ENV="production"
DOMAIN=""
FRONTEND_URL=""
DOMAIN="localhost"
FRONTEND_URL="http://localhost:3000"
# Frontend (build-stage)
VITE_ACCOUNT_CREATION_ENABLED="$ACCOUNT_CREATION_ENABLED"
VITE_VIEW_COOKIE_PATH="/"
VITE_COOKIE_SAME_SITE="strict"
VITE_VIEW_COOKIE_DOMAIN="$DOMAIN"

View File

@ -23,9 +23,7 @@ const CSRF_EXP_MS = 12 * 60 * 60 * 1000 // 12 h.
const REFRESH_BUF = 30 * 1000 // 30 s.
// view cookie configuration (holds UNIX timestamp value of the actual refresh token cookie's expiration date)
const VIEW_COOKIE_PATH = import.meta.env.VITE_VIEW_COOKIE_PATH || "/"
const VIEW_COOKIE_DOMAIN = import.meta.env.VITE_VIEW_COOKIE_DOMAIN || "localhost"
const COOKIE_SAME_SITE = import.meta.env.VITE_COOKIE_SAME_SITE || "strict"
const COOKIE_SECURE = import.meta.env.PROD ? true : false
// some of these could just be local variables as not all of them are being used globally
@ -250,7 +248,7 @@ class ApiClient {
}
// overwrite the view cookie with details that match with the real cookie
document.cookie = `${this.viewCookieName}=;path=${VIEW_COOKIE_PATH};domain=${VIEW_COOKIE_DOMAIN};expires=Thu, 01 Jan 1970 00:00:00 GMT;${COOKIE_SECURE ? "secure;" : ""}sameSite=${COOKIE_SAME_SITE}`
document.cookie = `${this.viewCookieName}=;path=/;domain=${VIEW_COOKIE_DOMAIN};expires=Thu, 01 Jan 1970 00:00:00 GMT;${COOKIE_SECURE ? "secure;" : ""}sameSite=strict`
}
private getCookieValue(cookieName: string): string | null {