From 539368e7756249ffea502c6747e5a162d295904a Mon Sep 17 00:00:00 2001 From: Matthias Van Parijs Date: Mon, 9 Sep 2024 22:13:58 +0200 Subject: [PATCH] feat: Added STITCHER_BASE_URL env variable --- packages/stitcher/src/env.ts | 1 + packages/stitcher/src/index.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/stitcher/src/env.ts b/packages/stitcher/src/env.ts index 0041c28d..6788e7ce 100644 --- a/packages/stitcher/src/env.ts +++ b/packages/stitcher/src/env.ts @@ -8,6 +8,7 @@ if (configPath) { } const envSchema = z.object({ + STITCHER_BASE_URL: z.string().optional(), PORT: z.coerce.number().default(52002), HOST: z.string().default("0.0.0.0"), REDIS_HOST: z.string().default("redis"), diff --git a/packages/stitcher/src/index.ts b/packages/stitcher/src/index.ts index 5370c4b8..e762da7e 100644 --- a/packages/stitcher/src/index.ts +++ b/packages/stitcher/src/index.ts @@ -21,7 +21,8 @@ async function buildServer() { const router = s.router(contract, { postSession: async ({ request, body }) => { const session = await createSession(body); - const baseUrl = `${request.protocol}://${request.hostname}`; + const baseUrl = + env.STITCHER_BASE_URL ?? `${request.protocol}://${request.hostname}`; return { status: 200,