Expand description
Global configuration functions
This module provides global configuration access and testing utilities.
§Testing with Global Configuration
Tests can override global configuration using global::lock
. This ensures that
such tests are serialized (and cannot clobber each other’s overrides).
ⓘ
#[test]
fn test_my_feature() {
let config = hyperactor::config::global::lock();
let _guard = config.override_key(SOME_CONFIG_KEY, test_value);
// ... test logic here ...
}
Structs§
- Config
Lock - A guard that holds the global configuration lock and provides override functionality.
- Config
Value Guard - A guard that restores a single configuration value when dropped
Functions§
- attrs
- Get the global attrs
- get
- Get a key from the global configuration. Currently only available for Copy types.
get
assumes that the key has a default value. - init_
from_ env - Initialize the global configuration from environment variables
- init_
from_ yaml - Initialize the global configuration from a YAML file
- lock
- Acquire the global configuration lock for testing.
- reset_
to_ defaults - Reset the global configuration to defaults (for testing only)