Module global

Source
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§

ConfigLock
A guard that holds the global configuration lock and provides override functionality.
ConfigValueGuard
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)