From 75e435bd03c327ad30cb0f682b9ac055af78d150 Mon Sep 17 00:00:00 2001 From: june Date: Tue, 12 Aug 2025 13:48:31 +1200 Subject: [PATCH] [PIE-2] Replace hardcoded PB URL (!3) Co-authored-by: june Co-committed-by: june --- .env.example | 2 +- src/lib/pocketbase/index.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 0a24c2b..a30a595 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ PB_ADMIN_EMAIL=admin@example.com PB_ADMIN_PASSWORD=secret-password -PB_URL=http://pocketbase:8080 +PUBLIC_PB_URL=http://pb:8080 PB_DATA_DIR=/pb/pb_data \ No newline at end of file diff --git a/src/lib/pocketbase/index.ts b/src/lib/pocketbase/index.ts index 67da881..f6df5e7 100644 --- a/src/lib/pocketbase/index.ts +++ b/src/lib/pocketbase/index.ts @@ -10,7 +10,7 @@ import type { } from "pocketbase"; import { readable, type Readable, type Subscriber } from "svelte/store"; import { browser } from "$app/environment"; -// import { PB_URL } from "$env/static/private"; +import { PUBLIC_PB_URL } from "$env/static/public"; import { base } from "$app/paths"; import { invalidateAll } from "$app/navigation"; import type { TypedPocketBase } from "./pocketbase-types"; // npx pocketbase-typegen --url http://localhost:8080 --email admin@example.com --password 'secret-password' @@ -20,11 +20,7 @@ import type { TypedPocketBase } from "./pocketbase-types"; // npx pocketbase-typ // } from "@simplewebauthn/browser"; // import { alerts } from "$lib/components/Alerts.svelte"; -export const client = new PocketBase( - // browser ? window.location.origin + base : undefined - // "http://pb:8080" - "http://localhost:8080" // FIXME: use env -) as TypedPocketBase; +export const client = new PocketBase(PUBLIC_PB_URL) as TypedPocketBase; export const authModel = readable( null,