From 78b2fb3b8faf525c7b301fb2d1e169547de9307b Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 6 Jul 2024 18:16:55 +0200 Subject: [PATCH] Move env varibles to dynamic runtime lookup --- Dockerfile | 6 ------ src/lib/cms/client.ts | 5 ++++- src/routes/uploads/[...path]/+server.ts | 4 +++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f11ea2..7147efa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,5 @@ FROM docker.io/node:20.15.0-alpine AS builder -ARG STRAPI_CMS_URL -ENV STRAPI_CMS_URL $STRAPI_CMS_URL - -ARG STRAPI_CMS_API_KEY -ENV STRAPI_CMS_API_KEY $STRAPI_CMS_API_KEY - ENV NODE_ENV production WORKDIR /app diff --git a/src/lib/cms/client.ts b/src/lib/cms/client.ts index cc7586c..e61f2a9 100644 --- a/src/lib/cms/client.ts +++ b/src/lib/cms/client.ts @@ -1,5 +1,8 @@ import qs from "qs"; -import { STRAPI_CMS_API_KEY, STRAPI_CMS_URL } from "$env/static/private"; +import { env } from "$env/dynamic/private"; + +const STRAPI_CMS_API_KEY = env.STRAPI_CMS_API_KEY; +const STRAPI_CMS_URL = env.STRAPI_CMS_URL; interface Props { endpoint: string; diff --git a/src/routes/uploads/[...path]/+server.ts b/src/routes/uploads/[...path]/+server.ts index 35e976f..bccbe6f 100644 --- a/src/routes/uploads/[...path]/+server.ts +++ b/src/routes/uploads/[...path]/+server.ts @@ -1,4 +1,6 @@ -import { STRAPI_CMS_URL } from "$env/static/private"; +import { env } from "$env/dynamic/private"; + +const STRAPI_CMS_URL = env.STRAPI_CMS_URL; export async function GET({ params,