Files
ppq-private-mode-startos/startos/main.ts
T
mattius459andClaude Fable 5 b2659a7082 Address review: drop unused /data mount, document key in backups
- The proxy is stateless and env-configured; the 'main' volume is no
  longer mounted into the container (config.json is read host-side)
- README/instructions note that backups contain the saved API key
- Upstream tagged v0.3.2 (matches package.json); submodule checked out
  at the tag

Verified on the StartOS 0.4.0 VM: update installs over the previous
version, keeps the saved key, and reports attestation-verified health.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 11:12:36 +02:00

46 lines
1.5 KiB
TypeScript

import { i18n } from './i18n'
import { sdk } from './sdk'
import { apiPort } from './utils'
import { configJson } from './fileModels/config.json'
export const main = sdk.setupMain(async ({ effects }) => {
console.info(i18n('Starting PPQ Private Mode!'))
// Read reactively so the daemon restarts when the user changes settings.
const apiKey = await configJson.read((c) => c.apiKey).const(effects)
const debug = await configJson.read((c) => c.debug).const(effects)
return sdk.Daemons.of(effects).addDaemon('proxy', {
// The proxy is stateless and fully configured via env — the 'main' volume
// (config.json, read host-side by the SDK) is never mounted into the
// container.
subcontainer: sdk.SubContainer.of(
effects,
{ imageId: 'proxy' },
sdk.Mounts.of(),
'proxy-sub',
),
exec: {
command: ['node', '/app/dist/bin/server.js'],
env: {
PPQ_API_KEY: apiKey ?? '',
HOST: '0.0.0.0',
PORT: apiPort.toString(),
DEBUG: debug ? 'true' : 'false',
},
},
// The proxy only binds its port after remote attestation of the enclave
// succeeds, so a listening port means the encrypted channel is verified
// and ready.
ready: {
display: i18n('Encrypted Proxy'),
fn: () =>
sdk.healthCheck.checkPortListening(effects, apiPort, {
successMessage: i18n('The proxy is ready — enclave attestation verified'),
errorMessage: i18n('The proxy is not ready (enclave attestation pending)'),
}),
},
requires: [],
})
})