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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user