From 3ebfeef1ca46a2f116e117ca28553d09a4cb0152 Mon Sep 17 00:00:00 2001 From: Borja Garibotti Date: Wed, 15 May 2024 18:52:54 -0300 Subject: [PATCH] Fix env vars import --- my-app/.dockerignore | 10 ++++++++++ my-app/src/lib/api.ts | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 my-app/.dockerignore diff --git a/my-app/.dockerignore b/my-app/.dockerignore new file mode 100644 index 0000000..6635cf5 --- /dev/null +++ b/my-app/.dockerignore @@ -0,0 +1,10 @@ +.DS_Store +node_modules +/build +/.svelte-kit +/package +.env +.env.* +!.env.example +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/my-app/src/lib/api.ts b/my-app/src/lib/api.ts index 5894610..4b923a5 100644 --- a/my-app/src/lib/api.ts +++ b/my-app/src/lib/api.ts @@ -1,3 +1,4 @@ +import { env } from '$env/dynamic/private'; import { error } from '@sveltejs/kit'; type Method = 'GET' | 'POST' | 'DELETE' | 'PUT'; @@ -13,7 +14,7 @@ type Opts = { body?: string; }; -const base = import.meta.env.VITE_API_URL; +const base = env.VITE_API_URL; async function send(method: Method, { path, data, headers = {} }: Request) { const opts: Opts = { method, headers };