adopt 0.4's persistent key store and browser setup form

The earlier bump took 0.4.1 for its model catalog and status page but
left PPQ_DATA_DIR unset, which disabled the key form the release exists
to add. Enable it, and let the proxy own the key outright.

PPQ_API_KEY is no longer passed. The volume's `proxy/` subpath mounts at
/data as PPQ_DATA_DIR, so upstream's key store is the single source of
truth: the Status Page and the Configure PPQ API Key action write the
same config.json, and there is no StartOS-side copy to revert what the
browser saved. A chown oneshot hands /data to the image's `node` user so
the page can write there.

Verbose Logging moves to store.json outside the mount, because upstream
rewrites config.json wholesale when a key is saved and would drop it.

main.ts watches config.json — upstream loads it once at startup, so the
watch is what makes the action take effect: the write restarts the
daemon, which reloads the file. A key saved on the page applies
immediately and converges through the same restart.

The task drops from critical to important. A critical task suspends
every other control, so it would have left the user unable to start the
service and reach the page's own form — and with PPQ_DATA_DIR set the
proxy no longer exits keyless; it attests, serves the page, and answers
401 until a key exists. main.ts clears the task when a key appears,
since saving on the page never touches the action that would clear it.

The action's key field is now validated against upstream's own
^sk-[A-Za-z0-9]{16,64}$ shape and no longer refuses a blank submission,
a key having become optional.
This commit is contained in:
helix-nine committed 2026-08-12 09:58:35 -06:00
1 parent 42b2841945
commit 8397c7b1eb
10 files changed
+213 -140

No files matched your search

+5 -5
View File
@@ -1,15 +1,15 @@
import { FileHelper, z } from '@start9labs/start-sdk'
import { sdk } from '../sdk'
// Package-owned settings file on the main volume. The upstream proxy is
// configured purely through environment variables; main.ts bridges these
// values into the daemon's env.
// Upstream's own persistent config, at <PPQ_DATA_DIR>/config.json. The proxy
// loads the key from here at startup and rewrites the whole file when one is
// saved from the status page, so this shape must stay exactly upstream's and
// nothing else may live in it — see fileModels/store.json.ts.
const shape = z.object({
apiKey: z.string().optional().catch(undefined),
debug: z.boolean().catch(false),
})
export const configJson = FileHelper.json(
{ base: sdk.volumes.main, subpath: 'config.json' },
{ base: sdk.volumes.main, subpath: 'proxy/config.json' },
shape,
)
+13
View File
@@ -0,0 +1,13 @@
import { FileHelper, z } from '@start9labs/start-sdk'
import { sdk } from '../sdk'
// Package-owned settings, kept outside the mounted PPQ_DATA_DIR subtree so the
// proxy neither sees them nor overwrites them.
const shape = z.object({
debug: z.boolean().catch(false),
})
export const storeJson = FileHelper.json(
{ base: sdk.volumes.main, subpath: 'store.json' },
shape,
)