fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL (#21682)

* fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL

* turn spread into a push, simpler
This commit is contained in:
Alex van Andel
2025-06-02 19:21:38 +01:00
committed by GitHub
parent c2240f0bad
commit 07ffc3fade
+7 -8
View File
@@ -48,10 +48,6 @@ if (!process.env.EMAIL_FROM) {
if (!process.env.NEXTAUTH_URL) throw new Error("Please set NEXTAUTH_URL");
if (!process.env.NEXT_PUBLIC_API_V2_URL) {
console.error("Please set NEXT_PUBLIC_API_V2_URL");
}
const getHttpsUrl = (url) => {
if (!url) return url;
if (url.startsWith("http://")) {
@@ -335,10 +331,6 @@ const nextConfig = {
].filter(Boolean);
let afterFiles = [
{
source: "/api/v2/:path*",
destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
},
{
source: "/org/:slug",
destination: "/team/:slug",
@@ -375,6 +367,13 @@ const nextConfig = {
}, */
];
if (Boolean(process.env.NEXT_PUBLIC_API_V2_URL)) {
afterFiles.push({
source: "/api/v2/:path*",
destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
});
}
return {
beforeFiles,
afterFiles,