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
- Product / RESP endpoint —
PG_REDIS_
Settings that belong to the Redis-facing gateway (listen port, storage mode, memory snapshot interval, compat harness). - PostgreSQL backend —
POSTGRESQL_
Host, port, and database the gateway (or container) uses to reach Postgres. - Auth — unprefixed
USERNAME/PASSWORD
The role used for Postgres (and exposed to Redis clients as the store identity). - Behavior flags — plain verbs, no product prefix when they are not
product-specific:
REQUIRE_POSTGRES,ALLOW_EXTERNAL_CONNECTIONS,ASYNC_RUNTIME_WORKER_THREADS. - 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.databaseredis_gateway.setup_configuration_filepg_redis.ttl_delete_batch_size(default1000) — SQL TTL sweeper keys/roundpg_redis.ttl_delete_max_rounds(default10) — rounds perdelete_expired_keyscall
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 initPGPORT— libpq default port inside the container (set fromPOSTGRESQL_PORT)PG_REDIS_COMPAT_HOST/PG_REDIS_COMPAT_PORT— Valkey compat harness only
(PG_REDIS_COMPAT_PORTfalls back toPG_REDIS_PORT)
Adding a new setting
- Add a PascalCase field to
SetupConfiguration(+ JSON default files). - Add one SCREAMING_SNAKE env override following the prefix rules above.
- Document it here and in the README env table.
- Cover it with a unit test in
config.rs.