Skip to content

Commit

Permalink
fix: refine BASE_URL generation with HTTPS protocol
Browse files Browse the repository at this point in the history
- Explicitly add HTTPS protocol to Vercel URLs
- Improve URL generation for production and preview environments
- Ensure consistent URL formatting with protocol prefix
  • Loading branch information
Titou325 committed Feb 18, 2025
1 parent 4b14cb9 commit 95028f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/studio/src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const BASE_URL =
(process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
? process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL
: process.env.NEXT_PUBLIC_VERCEL_URL) || "http://localhost:3000";
(process.env.NEXT_PUBLIC_VERCEL_ENV === "production" &&
`https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`) ||
(process.env.NEXT_PUBLIC_VERCEL_URL && `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`) ||
"http://localhost:3000";

export const getURL = (path = "") => {
return new URL(path, BASE_URL).toString();
Expand Down

0 comments on commit 95028f9

Please sign in to comment.