🐛 fix: use dynamic env for MIDDLEWARE_URL in server middleware

- Replace static private env import with dynamic env
- Add default value for MIDDLEWARE_URL
- Fixes build error where MIDDLEWARE_URL wasn't defined
This commit is contained in:
Wuesteon 2025-12-15 22:33:23 +01:00
parent 2c30867251
commit b8d1067414

View file

@ -1,4 +1,4 @@
import { MIDDLEWARE_URL } from '$env/static/private';
import { env } from '$env/dynamic/private';
/**
* Server-side only middleware client
@ -12,6 +12,8 @@ export async function callMiddleware(
headers?: Record<string, string>;
} = {}
) {
const MIDDLEWARE_URL =
env.MIDDLEWARE_URL || 'https://mana-core-middleware-111768794939.europe-west3.run.app';
const url = `${MIDDLEWARE_URL}${endpoint}`;
const response = await fetch(url, {