Skip to content

Commit

Permalink
chore(tRPC): customize backend URL in production without rebuilding t…
Browse files Browse the repository at this point in the history
…he image
  • Loading branch information
bludnic committed Jan 21, 2024
1 parent 0dfd2ec commit f8fa3b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/frontend/src/lib/trpc/getBaseUrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
export function getBaseUrl(): string {
const isProduction = process.env.NODE_ENV === "production";
if (isProduction) {
if (typeof window !== "undefined") {
const customURL = localStorage.getItem("APP_URL");

// browser should use relative path
return customURL ? customURL : "";
}
}

if (process.env.NEXT_PUBLIC_PROCESSOR_ENABLE_TRPC) {
return `${process.env.NEXT_PUBLIC_PROCESSOR_URL}`;
}
Expand Down

0 comments on commit f8fa3b0

Please sign in to comment.