From 7aea7703f67e4280ef5b407c26b854f45c0c3df0 Mon Sep 17 00:00:00 2001 From: mbaharip <62494292+mbahArip@users.noreply.github.com> Date: Sat, 6 Apr 2024 22:24:36 +0700 Subject: [PATCH] Set `NEXT_PUBLIC_DOMAIN` as a fallback of `NEXT_PUBLIC_VERCEL_URL` --- .env.example | 1 + src/config/gIndex.config.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 1331e9b..5bea85b 100644 --- a/.env.example +++ b/.env.example @@ -4,5 +4,6 @@ NEXT_PUBLIC_ENCRYPTION_KEY= NEXT_PUBLIC_SITE_PASSWORD= # Only fill with the domain name, without the protocol and trailing slash +# This will be used as a fallback if VERCEL_URL is not available # Example: https://drive-demo.mbaharip.com -> drive.mbaharip.com NEXT_PUBLIC_DOMAIN= diff --git a/src/config/gIndex.config.ts b/src/config/gIndex.config.ts index 0747385..9e1bb35 100644 --- a/src/config/gIndex.config.ts +++ b/src/config/gIndex.config.ts @@ -17,7 +17,9 @@ const config: z.input = { basePath: process.env.NODE_ENV === "development" ? "http://localhost:3000" - : `https://${process.env.NEXT_PUBLIC_DOMAIN}`, + : `https://${ + process.env.NEXT_PUBLIC_VERCEL_URL || process.env.NEXT_PUBLIC_DOMAIN + }`, /** * DEPRECATED