diff --git a/src/lib/cloud-store.test.ts b/src/lib/cloud-store.test.ts index b4a273a..855127b 100644 --- a/src/lib/cloud-store.test.ts +++ b/src/lib/cloud-store.test.ts @@ -20,7 +20,7 @@ describe("logs cloud-store resolver (self_hosted client flip)", () => { test("returns null (local) when mode=local even with url+key present", () => { const store = resolveLogsCloudStore({ HASNA_LOGS_STORAGE_MODE: "local", - HASNA_LOGS_API_URL: "https://logs.hasna.xyz", + HASNA_LOGS_API_URL: "https://logs.your-deployment.example", HASNA_LOGS_API_KEY: "k_fake_test_key", } as NodeJS.ProcessEnv); expect(store).toBeNull(); @@ -30,28 +30,28 @@ describe("logs cloud-store resolver (self_hosted client flip)", () => { expect(() => resolveLogsCloudStore({ HASNA_LOGS_STORAGE_MODE: "self_hosted", - HASNA_LOGS_API_URL: "https://logs.hasna.xyz", + HASNA_LOGS_API_URL: "https://logs.your-deployment.example", } as NodeJS.ProcessEnv), ).toThrow(); }); - test("resolves a cloud-http store at .hasna.xyz/v1 when self_hosted + url + key", () => { + test("resolves a cloud-http store at .your-deployment.example/v1 when self_hosted + url + key", () => { const store = resolveLogsCloudStore({ HASNA_LOGS_STORAGE_MODE: "self_hosted", - HASNA_LOGS_API_URL: "https://logs.hasna.xyz", + HASNA_LOGS_API_URL: "https://logs.your-deployment.example", HASNA_LOGS_API_KEY: "k_fake_test_key", } as NodeJS.ProcessEnv); expect(store).not.toBeNull(); - expect(store!.baseUrl).toBe("https://logs.hasna.xyz/v1"); + expect(store!.baseUrl).toBe("https://logs.your-deployment.example/v1"); }); - test("defaults the base URL to https://logs.hasna.xyz/v1 when only mode+key set", () => { + test("defaults the base URL to https://logs.your-deployment.example/v1 when only mode+key set", () => { const store = resolveLogsCloudStore({ HASNA_LOGS_STORAGE_MODE: "self_hosted", HASNA_LOGS_API_KEY: "k_fake_test_key", } as NodeJS.ProcessEnv); expect(store).not.toBeNull(); - expect(store!.baseUrl).toBe("https://logs.hasna.xyz/v1"); + expect(store!.baseUrl).toBe("https://logs.your-deployment.example/v1"); }); // Regression: the fleet flip writes ONLY these two vars (no storage-mode var). @@ -59,11 +59,11 @@ describe("logs cloud-store resolver (self_hosted client flip)", () => { // an installed CLI silently keeps reading local even with the env set. test("routes to cloud when only the two flip vars (url + key) are set — no mode var", () => { const store = resolveLogsCloudStore({ - HASNA_LOGS_API_URL: "https://logs.hasna.xyz", + HASNA_LOGS_API_URL: "https://logs.your-deployment.example", HASNA_LOGS_API_KEY: "k_fake_test_key", } as NodeJS.ProcessEnv); expect(store).not.toBeNull(); - expect(store!.baseUrl).toBe("https://logs.hasna.xyz/v1"); + expect(store!.baseUrl).toBe("https://logs.your-deployment.example/v1"); }); test("key alone (no url, no mode var) stays local — flip writes both vars together", () => { @@ -75,7 +75,7 @@ describe("logs cloud-store resolver (self_hosted client flip)", () => { test("url alone (no key) stays local when no mode var is set", () => { const store = resolveLogsCloudStore({ - HASNA_LOGS_API_URL: "https://logs.hasna.xyz", + HASNA_LOGS_API_URL: "https://logs.your-deployment.example", } as NodeJS.ProcessEnv); expect(store).toBeNull(); }); diff --git a/src/lib/cloud-store.ts b/src/lib/cloud-store.ts index 20cd686..561e4f3 100644 --- a/src/lib/cloud-store.ts +++ b/src/lib/cloud-store.ts @@ -7,8 +7,8 @@ * When the client-flip contract resolves to `cloud-http` (i.e. * HASNA_LOGS_STORAGE_MODE=self_hosted AND HASNA_LOGS_API_URL + HASNA_LOGS_API_KEY * are set), ALL log reads and writes are routed to the app's cloud HTTP API - * (`https://logs.hasna.xyz/v1/logs`) with the bearer key — NOT the local SQLite - * store, NOT a raw DSN. + * (the configured HASNA_LOGS_API_URL, e.g. https://logs.your-deployment.example/v1/logs) + * with the bearer key — NOT the local SQLite store, NOT a raw DSN. * * When the flip does not resolve to cloud, this returns `null` and the CLI uses * its local SQLite store exactly as before (fully reversible: unset the env vars diff --git a/src/server/cloud/openapi.ts b/src/server/cloud/openapi.ts index 00e8fbf..53be44e 100644 --- a/src/server/cloud/openapi.ts +++ b/src/server/cloud/openapi.ts @@ -9,7 +9,7 @@ export interface OpenApiDoc { openapi: string; info: { title: string; version: string; description?: string }; - servers?: { url: string }[]; + servers?: { url: string; description?: string }[]; security?: Record[]; components: Record; paths: Record; @@ -31,7 +31,12 @@ export function buildOpenApiDocument(version: string): OpenApiDoc { "Cloud API for @hasna/logs — the shared, S3-backed log sink. All /v1 " + "routes require a Hasna API key (x-api-key or Authorization: Bearer).", }, - servers: [{ url: "https://logs.hasna.xyz" }], + servers: [ + { + url: "https://your-deployment.example", + description: "Replace with your self-hosted @hasna/logs deployment's base URL.", + }, + ], components: { securitySchemes: { apiKey: { type: "apiKey", in: "header", name: "x-api-key" },