Skip to content

Commit 07ffc3f

Browse files
authored
fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL (calcom#21682)
* fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL * turn spread into a push, simpler
1 parent c2240f0 commit 07ffc3f

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

apps/web/next.config.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ if (!process.env.EMAIL_FROM) {
4848

4949
if (!process.env.NEXTAUTH_URL) throw new Error("Please set NEXTAUTH_URL");
5050

51-
if (!process.env.NEXT_PUBLIC_API_V2_URL) {
52-
console.error("Please set NEXT_PUBLIC_API_V2_URL");
53-
}
54-
5551
const getHttpsUrl = (url) => {
5652
if (!url) return url;
5753
if (url.startsWith("http://")) {
@@ -335,10 +331,6 @@ const nextConfig = {
335331
].filter(Boolean);
336332

337333
let afterFiles = [
338-
{
339-
source: "/api/v2/:path*",
340-
destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
341-
},
342334
{
343335
source: "/org/:slug",
344336
destination: "/team/:slug",
@@ -375,6 +367,13 @@ const nextConfig = {
375367
}, */
376368
];
377369

370+
if (Boolean(process.env.NEXT_PUBLIC_API_V2_URL)) {
371+
afterFiles.push({
372+
source: "/api/v2/:path*",
373+
destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
374+
});
375+
}
376+
378377
return {
379378
beforeFiles,
380379
afterFiles,

0 commit comments

Comments
 (0)