mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-10 20:35:17 +02:00
refactor(api): replace backend URL constant with dynamic function for improved flexibility
- Updated the backend URL initialization to use a function that retrieves the URL from environment variables, enhancing configurability for different environments.
This commit is contained in:
parent
8e32df4496
commit
39bc903eab
1 changed files with 6 additions and 2 deletions
|
|
@ -1,12 +1,16 @@
|
|||
import { mustGetQuery } from "@rocicorp/zero";
|
||||
import { handleQueryRequest } from "@rocicorp/zero/server";
|
||||
import { NextResponse } from "next/server";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
import type { Context } from "@/types/zero";
|
||||
import { queries } from "@/zero/queries";
|
||||
import { schema } from "@/zero/schema";
|
||||
|
||||
const backendURL = BACKEND_URL;
|
||||
function getBackendBaseUrl() {
|
||||
const base = process.env.FASTAPI_BACKEND_INTERNAL_URL || "http://localhost:8000";
|
||||
return base.endsWith("/") ? base.slice(0, -1) : base;
|
||||
}
|
||||
|
||||
const backendURL = getBackendBaseUrl();
|
||||
|
||||
async function authenticateRequest(
|
||||
request: Request
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue