mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +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 { mustGetQuery } from "@rocicorp/zero";
|
||||||
import { handleQueryRequest } from "@rocicorp/zero/server";
|
import { handleQueryRequest } from "@rocicorp/zero/server";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { BACKEND_URL } from "@/lib/env-config";
|
|
||||||
import type { Context } from "@/types/zero";
|
import type { Context } from "@/types/zero";
|
||||||
import { queries } from "@/zero/queries";
|
import { queries } from "@/zero/queries";
|
||||||
import { schema } from "@/zero/schema";
|
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(
|
async function authenticateRequest(
|
||||||
request: Request
|
request: Request
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue