Skip to content

fix(#381): add WAL backup configuration guard#558

Merged
Junman140 merged 1 commit into
Pi-Defi-world:mainfrom
DevSolex:fix/381-no-wal-backup-configured
Jun 27, 2026
Merged

fix(#381): add WAL backup configuration guard#558
Junman140 merged 1 commit into
Pi-Defi-world:mainfrom
DevSolex:fix/381-no-wal-backup-configured

Conversation

@DevSolex

Copy link
Copy Markdown
Contributor

Summary

Configures a startup guard for PostgreSQL WAL archiving to prevent permanent data loss on storage failure.

Changes

  • src/config/env.ts — adds PG_WAL_BACKUP_CONFIGURED (bool) and PG_WAL_BACKUP_PROVIDER (label) env vars, exposed on config.walBackup
  • src/config/database.tsconnectWithRetry() refuses to start in production when PG_WAL_BACKUP_CONFIGURED !== "true"; logs backup status on every boot
  • .env.example — documents both vars with examples
  • tests/walBackup.test.ts — 4 tests: throws when unset (prod), throws when false (prod), connects when true (prod), passes in dev

Testing

PASS tests/walBackup.test.ts
  #381 WAL backup guard
    ✓ throws in production when PG_WAL_BACKUP_CONFIGURED is not set
    ✓ throws in production when PG_WAL_BACKUP_CONFIGURED=false
    ✓ connects successfully in production when PG_WAL_BACKUP_CONFIGURED=true
    ✓ does not throw in development when PG_WAL_BACKUP_CONFIGURED is not set

Closes #381

Configure PostgreSQL WAL archiving check at startup:
- env: PG_WAL_BACKUP_CONFIGURED / PG_WAL_BACKUP_PROVIDER vars
- database: refuse production boot when WAL backup not confirmed
- test: 4 cases covering prod/dev, configured/unconfigured

Closes Pi-Defi-world#381
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8a691a97-0c07-47a3-b108-9591b2d3237c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Junman140 Junman140 merged commit 02249e9 into Pi-Defi-world:main Jun 27, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants