Skip to content

Store relay settings overrides in PostgreSQL (SETTINGS_BACKEND=db) #757

Description

@Ferryx349

Problem

Operator settings overrides currently live in settings.yaml under NOSTR_CONFIG_DIR with legacy settings.json fallback. That creates operational friction:

  • When nostream releases add new default settings keys, operators editing YAML may not know new values exist or need to be added.
  • Deploy/bootstrap flows copy config files that can drift from what the application expects after upgrades.
  • Operators end up maintaining files that are easy to overwrite or fall out of sync with releases.
    We need durable storage for operator overrides that survives upgrades without requiring manual YAML edits for every new setting.

Proposal

Store only operator overrides in PostgreSQL — not the full settings blob. Shipped defaults remain in resources/default-settings.yaml and are merged at runtime.

  • Add a settings_overrides table (path TEXT PK, value JSONB, updated_at TIMESTAMPTZ).
  • Introduce SETTINGS_BACKEND=file|db (default: file for backwards compatibility).
  • When SETTINGS_BACKEND=db:
    • Bootstrap loads overrides from PostgreSQL on startup.
    • If the table is empty, import existing settings.yaml / legacy settings.json once.
    • Admin settings PATCH and restore persist overrides to the DB.
    • Runtime settings = shipped defaults merged with DB overrides.

Out of scope (follow-ups)

  • DB-mode backup snapshots on each PATCH file mode still creates timestamped YAML backups.
  • Hot-reload of DB overrides across all cluster workers after admin changes.
  • Refactoring compose, bootstrap copied files so operators never edit release-owned files.
  • Full settings schema migration, versioning in the DB.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions