Skip to main content

Module env

Module env 

Source
Expand description

Environment and mode detection utilities.

Three separate concerns:

  • is_testnet_mode(), “which network?” Controls chain IDs, the default catalog path selection, and other network-specific settings. Set on all testnet and staging deployments.
  • test_endpoints_enabled(), “allow dangerous /test/* endpoints?” Controls spot-price manipulation, IV overrides, instrument expiry, etc. Should only be set in local dev and CI, never on deployed environments.
  • faucet cargo feature: compile-time gate for the /faucet route. Enabled by test-endpoints (local dev, CI) or independently for testnet deploys. Never enabled for real-money builds (AWS staging, mainnet).

Functions§

block_on_async
Run an async block synchronously from sync code.
is_testnet_mode
Returns true if running in testnet/dev mode.
test_endpoints_enabled
Returns true if dangerous test manipulation endpoints are enabled.