Skip to content
pg_redis
Esc
navigateopen⌘Jpreview
On this page

Configuration

SetupConfiguration.json, environment overrides, GUCs, and naming rules.

Two layers, one vocabulary:

Layer Case Example
SetupConfiguration.json PascalCase GatewayListenPort
Environment overrides SCREAMING_SNAKE_CASE PG_REDIS_PORT

In-container config lives at docker/SetupConfiguration.json (UseLocalHost: false, listen 0.0.0.0:6379, Postgres redis / redis / pg_redis). Standalone uses repo-root SetupConfiguration.json.

Prefix rules

  1. Product / RESP endpointPG_REDIS_
    Settings that belong to the Redis-facing gateway (listen port, storage mode, memory snapshot interval, compat harness).
  2. PostgreSQL backendPOSTGRESQL_
    Host, port, and database the gateway (or container) uses to reach Postgres.
  3. Auth — unprefixed USERNAME / PASSWORD
    The role used for Postgres (and exposed to Redis clients as the store identity).
  4. Behavior flags — plain verbs, no product prefix when they are not product-specific: REQUIRE_POSTGRES, ALLOW_EXTERNAL_CONNECTIONS, ASYNC_RUNTIME_WORKER_THREADS.
  5. Do not invent aliases. One name per setting. No legacy fallbacks.

Environment ↔ JSON map

Environment JSON field Default
PG_REDIS_PORT GatewayListenPort 6379
PG_REDIS_STORAGE_MODE StorageMode (unlogged | logged | memory) unlogged
PG_REDIS_MEMORY_SNAPSHOT_INTERVAL_SECS MemorySnapshotIntervalSecs 60
POSTGRESQL_HOST PostgresHostName 127.0.0.1
POSTGRESQL_PORT PostgresPort 5432
POSTGRESQL_DATABASE PostgresDatabase pg_redis
USERNAME PostgresSystemUser redis
PASSWORD PostgresPassword redis
REQUIRE_POSTGRES RequirePostgres unset / false
ALLOW_EXTERNAL_CONNECTIONS inverts UseLocalHost unset
ASYNC_RUNTIME_WORKER_THREADS AsyncRuntimeWorkerThreads 2

Booleans accept 1 / true / yes (and 0 / false / no).

PG_REDIS_PORT=6380 POSTGRESQL_PORT=5433 make postgres-up
mise exec -- redis-cli -p 6380 PING

GUCs

In-process host GUCs (require shared_preload_libraries including pg_redis_gw_host):

  • redis_gateway.database
  • redis_gateway.setup_configuration_file
  • pg_redis.ttl_delete_batch_size (default 1000) — SQL TTL sweeper keys/round
  • pg_redis.ttl_delete_max_rounds (default 10) — rounds per delete_expired_keys call

Tune the TTL pair with ALTER SYSTEM / postgresql.conf + pg_reload_conf(), or SET before a manual CALL redis.delete_expired_keys().

Postgres GUCs are a separate surface from env/JSON — document them under README / compat/STATUS.md rather than inventing env aliases.

Container / tooling exceptions

These are not gateway config names; do not reuse them as new public APIs:

  • POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB — official Postgres image init
  • PGPORT — libpq default port inside the container (set from POSTGRESQL_PORT)
  • PG_REDIS_COMPAT_HOST / PG_REDIS_COMPAT_PORT — Valkey compat harness only
    (PG_REDIS_COMPAT_PORT falls back to PG_REDIS_PORT)

Adding a new setting

  1. Add a PascalCase field to SetupConfiguration (+ JSON default files).
  2. Add one SCREAMING_SNAKE env override following the prefix rules above.
  3. Document it here and in the README env table.
  4. Cover it with a unit test in config.rs.

Was this page helpful?