All checks were successful
CI / Lint, typecheck, test (push) Successful in 3m9s
CI / Build container images (push) Has been skipped
CD / Build and push images (push) Successful in 3m47s
CD / Deploy to Test (push) Successful in 8s
CD / Smoke tests against Test (push) Successful in 1m10s
CD / Promote to Int (push) Successful in 9s
CI / Auth e2e pack (push) Successful in 5m25s
CI / Import/export fidelity gate (push) Successful in 45s
New apps/backup service (ADR 0015): nightly pg_dump -Fc plus one tar of the uploads/plugins volumes as a consistent restore set on a new backups volume, retention prune that never removes the newest complete set, atomic status.json for the readiness/admin consumers (#85/#86), and a failure mail sent directly via nodemailer (the api may be the broken part) with de/en texts in the shared mails catalog. BACKUP_RUN_ONCE=1 gives the on-demand path; deploy/backup/restore.sh automates the documented restore runbook. The pure secret-store helpers moved to @dorfteich/shared so the sidecar resolves the wizard-written SMTP relay exactly like the api. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EwZ4jR4KFAPvpjWevfUGX1
25 lines
876 B
TypeScript
25 lines
876 B
TypeScript
import { existsSync, readFileSync } from 'node:fs';
|
|
|
|
import {
|
|
backupEnvSchema,
|
|
overlayEnv,
|
|
parseEnv,
|
|
parseSecretsFile,
|
|
type BackupEnv,
|
|
} from '@dorfteich/shared';
|
|
|
|
/**
|
|
* Loads the sidecar configuration the same way the api does (issue #80):
|
|
* the wizard-written secret store fills SMTP variables the container env
|
|
* does not set, and empty strings count as unset — compose passes optional
|
|
* variables as `""`. Without this, a wizard-configured relay would never
|
|
* reach the failure mail.
|
|
*/
|
|
export function loadBackupEnv(env: Record<string, string | undefined> = process.env): BackupEnv {
|
|
const secretsFile = backupEnvSchema.shape.SECRETS_FILE.parse(env.SECRETS_FILE || undefined);
|
|
const secrets = existsSync(secretsFile)
|
|
? parseSecretsFile(readFileSync(secretsFile, 'utf8'))
|
|
: {};
|
|
return parseEnv(backupEnvSchema, overlayEnv(env, secrets));
|
|
}
|