Skip to content

Configuration

Database Access

coap-broker supports two database modes:

  • DB_MODE=psql (default): direct PostgreSQL connection using libpq via PG_CONNINFO.
  • DB_MODE=postgrest: talk to PostgREST over HTTP.
  • auth via POSTGREST_JWT (static) OR LOCAL_AUTH_* (dev).

See .env.example for a full list of environment variables (pre-populated for the Vibrant.Platform local stack Postgres).

Real-time Settings (LISTEN/NOTIFY)

When using DB_MODE=psql, the broker automatically listens for PostgreSQL notifications on channel user_device_settings_update. When pg_eventsrv fires a notification on this channel, the broker fetches the updated settings and pushes them to CoAP observers.

Expected payload:

{"device_id": "<uuid>", "dml_action": "INSERT|UPDATE"}

No additional configuration is needed — the feature uses the same PG_CONNINFO connection.

Next steps