testing/cross_backend/default_backend_configs.ts

Family-shared BackendConfig builders for cross-process test backends.

Two consumer-facing factories — {@link make_default_ts_backend_config} and {@link make_default_rust_backend_config} — own the common shape for the JS-runtime (Deno/Node on V8) and Rust families respectively. Per-backend factories in consumer projects compose a small declaration against one of these and add consumer-specific env vars via extra_env.

Defaults baked in by family:

- TS — 'memory://' PGlite, 30s startup window, capabilities without trusted_proxy/login_rate_limit. The TS canonical path leaves these limiters null in test mode. - Rust — caller-supplied real Postgres URL (PGlite isn't reachable from tokio-postgres), 120s startup window (cargo first-build cost), capabilities including trusted_proxy + login_rate_limit + the FUZ_TESTING_RESET_DB_ON_STARTUP=true self-wipe gate.

Both builders default port_env_var to 'PORT'. Consumers whose binary reads a different name (e.g. zzz's ZZZ_PORT) override.

Common across both families: /api/rpc, /api/ws, /health, /api/account/bootstrap, cookie_name: 'fuz_session', the standard bootstrap block keyed off default_test_* constants. Builders call build_test_backend_paths(name) internally when the optional paths is omitted.

Declarations
#

6 declarations

view source

make_default_rust_backend_config
#

make_default_ts_backend_config
#

MakeDefaultRustBackendConfigOptions
#

testing/cross_backend/default_backend_configs.ts view source

MakeDefaultRustBackendConfigOptions

name

Diagnostic label; also used as the tmpdir prefix when paths is omitted.

type string
readonly

port

TCP port the binary listens on.

type number
readonly

start_command

argv passed to the spawn (first entry is the binary).

type ReadonlyArray<string>
readonly

database_url

Required — Rust needs real Postgres (PGlite isn't reachable from tokio-postgres). Consumers typically supply 'postgres://localhost/{repo}_test_{name}'.

type string
readonly

extra_env

Merged on top of the generic env baseline; later keys win.

type Readonly<Record<string, string>>
readonly

capabilities

readonly

paths

Pre-computed paths; defaults to build_test_backend_paths(name).

readonly

bootstrap_overrides

Override individual bootstrap fields (username/password/token).

type Partial<BackendBootstrapConfig>
readonly

port_env_var

Env-var name the binary reads for its port. Defaults to 'PORT'. Consumers whose binary reads a different name (e.g. 'ZZZ_PORT') override.

type string
readonly

rust_log

Initial value for RUST_LOG. Defaults to 'info'. Consumers pass their binary-specific module filter (e.g. 'info,zzz_server=info,testing_zzz_server=info').

type string
readonly

MakeDefaultTsBackendConfigOptions
#

testing/cross_backend/default_backend_configs.ts view source

MakeDefaultTsBackendConfigOptions

name

Diagnostic label; also used as the tmpdir prefix when paths is omitted.

type string
readonly

port

TCP port the binary listens on.

type number
readonly

start_command

argv passed to the spawn (first entry is the binary).

type ReadonlyArray<string>
readonly

database_url

Defaults to 'memory://' (in-memory PGlite).

type string
readonly

extra_env

Merged on top of the generic env baseline; later keys win.

type Readonly<Record<string, string>>
readonly

capabilities

readonly

paths

Pre-computed paths; defaults to build_test_backend_paths(name).

readonly

bootstrap_overrides

Override individual bootstrap fields (username/password/token).

type Partial<BackendBootstrapConfig>
readonly

port_env_var

Env-var name the binary reads for its port. Defaults to 'PORT'. Consumers whose binary reads a different name (e.g. 'ZZZ_PORT') override.

type string
readonly

rust_default_capabilities
#

testing/cross_backend/default_backend_configs.ts view source

BackendCapabilities

Capabilities for the Rust family. Adds trusted_proxy: true (the Rust spine's client-IP middleware is always wired; the env-gate just controls whether XFF is consulted vs the TCP peer IP) and login_rate_limit: true (env-gated bucket on /login + /password).

ts_default_capabilities
#

testing/cross_backend/default_backend_configs.ts view source

BackendCapabilities

Capabilities shared by TS-family backends — same canonical implementation, same feature set. No trusted-proxy phase (the test binary doesn't enable proxy parsing) and no per-account login rate limit (the TS canonical path leaves the limiter null in test mode).

Depends on
#