Skip to content

Gateway application manifest (v1)

This document defines substratum-gateway.json, an optional JSON file for operational gateway settings (database URL, HTTP bind, CORS, blockstore, logging). It complements substratum-triangle-v1 (mesh/triangle slice only).

When it is used

  • Release gateway binaries: if SUBSTRATUM_GATEWAY_CONFIG points to a file, or ./substratum-gateway.json exists in the process working directory, the file is read and merged with the process environment.
  • Debug (cargo run): the gateway JSON file is ignored for operational settings — use .env + env vars. An optional cwd .env is loaded via bootstrap_dotenv at the start of load_operational_from_env_only / load_operational_merged when present (non-fatal if missing).
  • Precedence: for every field, a non-empty environment variable always wins over the file. Docker, Kubernetes, and Compose therefore keep injecting secrets and overrides as today.

File locations

MechanismPath
Explicit pathSUBSTRATUM_GATEWAY_CONFIG=/path/to/substratum-gateway.json
Default (cwd)./substratum-gateway.json

JSON shape (schema_version 1)

FieldTypeRequired in fileDescription
schema_versionintegeryesMust be 1.
kindstringyesMust be substratum.gateway.application_v1.
database_urlstringno*Postgres URL for the app pool.
database_admin_urlstringnoBootstrap URL for SeaORM migrations (bootstrap_database).
postgres_passwordstringnoSame semantics as env POSTGRES_PASSWORD.
public_base_urlstringno*Public base URL (no trailing slash).
hoststringno*Bind IP, e.g. 0.0.0.0.
portintegerno*Bind port.
cors_allowed_originsstring[]no*Allowed browser origins (env uses comma-separated string).
rust_logstringnotracing filter; default info if unset everywhere.
log_jsonboolnoJSON logs when true (only if env SUBSTRATUM_LOG_JSON is unset).
s3_access_keystringnoEnables S3 blockstore when set (with secret).
s3_secret_keystringnoS3 secret (env S3_SECRET_KEY overrides).
s3_regionstringnoDefault us-east-1.
s3_bucketstringnoDefault substratum-blocks.
s3_endpointstringnoCustom S3-compatible endpoint.
flat_fs_blocks_pathstringnoFlatFS block path when S3 is not used; default ./data/blocks.
atproto_appview_urlstringnoAppView for public handle resolution; default Bluesky public AppView.
pds_urlstringnoInternal gateway → PDS base URL; default http://127.0.0.1:3000.
pds_public_urlstringnoBrowser-reachable PDS URL for OAuth; default http://localhost:3000.
pds_handle_domainstringnoAccount handle TLD (e.g. testalice.test); not the PDS OAuth issuer host.
pds_oauth_issuer_originstringnoOAuth issuer origin; when unset, derived from pds_public_url. Set to none to disable URL rewriting.
pds_admin_passwordstringnoPDS admin password for proxied signup invite codes.
pds_signup_enabledboolnoEnable POST /api/v1/pds/signup; when unset, enabled if pds_admin_password is set.

*After merge with env, each required operational value must be satisfied by env or file (see gateway process_env). Env keys use SCREAMING_SNAKE_CASE (e.g. PDS_HANDLE_DOMAIN overrides pds_handle_domain in the file).

Example (illustrative)

json
{
  "schema_version": 1,
  "kind": "substratum.gateway.application_v1",
  "database_url": "postgres://substratum_gateway:secret@127.0.0.1:5432/substratum",
  "public_base_url": "https://gateway.example",
  "host": "0.0.0.0",
  "port": 8080,
  "cors_allowed_origins": ["https://app.example"],
  "rust_log": "info",
  "flat_fs_blocks_path": "/var/lib/substratum/blocks",
  "pds_url": "http://127.0.0.1:3000",
  "pds_public_url": "http://localhost:3000",
  "pds_handle_domain": "test",
  "pds_oauth_issuer_origin": "http://localhost:3000"
}