Omnihedron

Configuration

CLI flags, environment variables, and database settings

All CLI flags accept environment variables with the OMNIHEDRON_ prefix.

CLI flags

FlagEnv varDefaultDescription
--name / -nOMNIHEDRON_NAMErequiredPostgreSQL schema name
--port / -pOMNIHEDRON_PORT3000HTTP port
--playgroundOMNIHEDRON_PLAYGROUNDoffEnable GraphiQL UI
--subscriptionOMNIHEDRON_SUBSCRIPTIONoffEnable WebSocket subscriptions
--aggregateOMNIHEDRON_AGGREGATEonEnable aggregation queries
--unsafe-modeOMNIHEDRON_UNSAFEoffDisable all query limits
--query-limitOMNIHEDRON_QUERY_LIMIT100Max records per query
--query-batch-limitOMNIHEDRON_QUERY_BATCH_LIMITMax queries in a single batch request
--query-depth-limitOMNIHEDRON_QUERY_DEPTH_LIMITMax query nesting depth
--query-alias-limitOMNIHEDRON_QUERY_ALIAS_LIMITMax field aliases per query
--query-complexityOMNIHEDRON_QUERY_COMPLEXITYMax query complexity score
--query-timeoutOMNIHEDRON_QUERY_TIMEOUT10000Query timeout in ms
--max-connectionOMNIHEDRON_MAX_CONNECTION10PostgreSQL pool size
--disable-hot-schemaOMNIHEDRON_DISABLE_HOT_SCHEMAoffDisable schema hot reload
--sl-keep-alive-intervalOMNIHEDRON_SL_KEEP_ALIVE_INTERVAL180000Schema listener keep-alive interval in ms
--metricsOMNIHEDRON_METRICSonEnable Prometheus metrics endpoint at /metrics
--shutdown-timeoutOMNIHEDRON_SHUTDOWN_TIMEOUT30Graceful shutdown timeout in seconds
--dictionary-optimisationOMNIHEDRON_DICTIONARY_OPTIMISATIONoffEnable dictionary optimisation for distinct queries
--query-explainOMNIHEDRON_QUERY_EXPLAINoffLog SQL EXPLAIN output
--indexerOMNIHEDRON_INDEXERMetadata HTTP fallback URL
--pg-caOMNIHEDRON_PG_CAPath to PostgreSQL CA certificate
--pg-keyOMNIHEDRON_PG_KEYPath to PostgreSQL client key
--pg-certOMNIHEDRON_PG_CERTPath to PostgreSQL client certificate
--log-levelOMNIHEDRON_LOG_LEVELinfofatal|error|warn|info|debug|trace
--output-fmtOMNIHEDRON_OUTPUT_FMTcoloredjson|colored
--log-pathOMNIHEDRON_LOG_PATHPath to log file
--log-rotateOMNIHEDRON_LOG_ROTATEoffEnable log file rotation

Database environment variables

VariableDescription
DB_HOSTPostgreSQL host
DB_PORTPostgreSQL port
DB_USERDatabase user
DB_PASSDatabase password
DB_DATABASEDatabase name
DB_HOST_READRead replica host (optional)

Runtime tuning

Tokio worker threads

TOKIO_WORKER_THREADS=8

Tokio defaults to one thread per CPU core. On a 128-core machine that's 256MB of idle thread stacks (128 cores × 2MB). For a PostgreSQL-bound service with a pool of 10 connections, 8–16 threads is optimal.

Logging

# Use RUST_LOG for fine-grained control
RUST_LOG=omnihedron=debug,tokio_postgres=warn

Example

omnihedron \
  --name app \
  --port 3000 \
  --max-connection 15 \
  --query-limit 200 \
  --query-timeout 15000 \
  --log-level debug \
  --aggregate \
  --playground

On this page