Skip to main content

Module runtime

Module runtime 

Source
Expand description

Live runtime state derived from the configuration snapshot.

AppStateInner holds the hot-swappable Config, but the media engine’s processor hooks are built once and only receive a TrackConfig, so the module switches they need live here in a process-wide ArcSwap. The reload path (AppStateInner::reload_config) updates both atomically enough for our purposes: a call reads whatever snapshot is current when it is set up.

Precedence for a module switch, highest first:

  1. the ops toggle file (PBX_TOGGLE_FILE, default /app/.env) — the emergency switch operators already use, read per call;
  2. [modules] in the active-call config file (hot-reloaded);
  3. enabled.

Structs§

ModuleSwitches
Effective module switches for the current config snapshot.

Functions§

apply_config
Publish the switches derived from a freshly loaded config. Called at startup and on every successful reload.
module_override
Resolve a module switch: toggle-file override first, then the value from the current config snapshot.
module_switches
Current module switches (cheap Arc clone; taken once per call setup).
toggle_file_path
Ops-managed toggle file. The deploy mounts the env file into the container; overridable via PBX_TOGGLE_FILE for tests/embedders.
toggle_value
Value of key in the toggle file: Some(false) when it is explicitly disabled, Some(true) when explicitly enabled, None when absent (so the caller’s configured default applies).
toggle_value_from
Same as toggle_value but against an explicit path (tests). KEY=false|0|off disables; KEY=true|1|on enables; anything else is treated as absent. Lines starting with # are ignored.