Make the deploy panel-friendly: zero-config compose, env vars with defaults

- compose.yaml runs only the app by default; Caddy moved to the
  'standalone' profile (the panel brings its own Caddy and routes).
- No env_file: every setting is ${VAR:-default} in compose.yaml, so it
  can be set from the panel's Environment tab (or .env standalone).
- VAPID keys are generated on first start and kept in the data volume;
  the push subject defaults to https://<site domain>. gen-vapid.ts removed.
- PUSH_DISABLED=1 turns push off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
This commit is contained in:
agent 2026-10-09 22:24:22 +00:00
parent 1382e53359
commit 04d952872d
11 changed files with 191 additions and 152 deletions

View file

@ -8,7 +8,7 @@ import { after, before, describe, it } from 'node:test';
import { createApp } from '../src/app.ts';
import { loadConfig } from '../src/config.ts';
import { Store } from '../src/db.ts';
import { encryptPayload, isAllowedEndpoint } from '../src/push.ts';
import { encryptPayload, isAllowedEndpoint, loadVapidKeys } from '../src/push.ts';
import { parseEcbXml } from '../src/rates.ts';
const b64u = (b: Buffer) => b.toString('base64url');
@ -161,6 +161,23 @@ describe('rates and static', () => {
});
});
describe('vapid keys', () => {
it('generates keys once and keeps them in the data dir', () => {
const d = mkdtempSync(join(tmpdir(), 'oweme-vapid-'));
const a = loadVapidKeys(d, '', '');
const b = loadVapidKeys(d, '', '');
assert.equal(a.publicKey, b.publicKey);
assert.match(a.publicKey, /^[A-Za-z0-9_-]{87}$/);
assert.equal(loadVapidKeys(d, 'pub', 'priv').publicKey, 'pub'); // env wins
rmSync(d, { recursive: true, force: true });
});
it('exposes the public key without any configuration', async () => {
const r = await api('GET', '/api/config');
assert.match(r.data.vapidPublicKey, /^[A-Za-z0-9_-]{87}$/);
});
});
describe('web push encryption', () => {
it('produces an RFC 8291 payload the browser side can decrypt', () => {
// Play the browser: generate a subscription key pair and auth secret.