From bb7f890a68682f85578535c0edc6a6af285c8bca Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Wed, 15 Jul 2026 16:25:40 +0200 Subject: [PATCH] keep overview: print which server it's talking to Surfaced by a real mix-up this session: KEEP_SERVER_URL was set to a "dev"-named hostname, and it was unclear without checking DNS/proxy config whether that was actually the same server as the one running on the deploy VPS or a separate instance -- nothing in `overview`'s output (vault names, recipient labels) says which server answered. Defaults silently to localhost:3050 if the env var isn't set at all, which is its own way to end up looking at the wrong thing. Printed before the fetch, not after, so it still shows up on a failed request ("error: fetch failed") -- the exact case where knowing the target mattered most and, before this, showed nothing at all. Verified against a local test server: shows the right URL on success, and shows the (default, unset) URL immediately before a deliberately failed fetch to a port nothing's listening on. Co-Authored-By: Claude Sonnet 5 --- src/cli/commands/recipient.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cli/commands/recipient.ts b/src/cli/commands/recipient.ts index 45a168d..da02f07 100644 --- a/src/cli/commands/recipient.ts +++ b/src/cli/commands/recipient.ts @@ -1,4 +1,4 @@ -import { adminFetch, expectOk } from '../signedFetch.js'; +import { adminFetch, expectOk, serverUrl } from '../signedFetch.js'; export async function recipientAdd(label: string, publicKey: string): Promise { const data = await expectOk(await adminFetch('POST', '/api/admin/recipients', { label, publicKey })); @@ -20,9 +20,18 @@ export async function recipientRemove(recipientId: string): Promise { } export async function adminOverview(): Promise { + // Printed before the fetch, not after -- which server this hit is exactly + // the thing that's ambiguous from the rest of the output alone (no vault + // or recipient here says "production" or "dev"), and defaults silently + // to localhost:3050 if KEEP_SERVER_URL isn't set. Printing it first means + // it still shows up even when the fetch itself fails ("error: fetch + // failed") -- the exact case where knowing the target mattered most and + // previously showed nothing at all. + console.log(`server: ${serverUrl()}`); + const data = await expectOk(await adminFetch('GET', '/api/admin/overview')); - console.log('recipients:'); + console.log('\nrecipients:'); if (!data.recipients.length) console.log(' none yet.'); for (const r of data.recipients) { console.log(` ${r.recipientId} ${r.label}`);