Skip to main content

config.loader

Configuration loading and feature extraction for exp.arolariu.ro.

ConfigLoaderStats Objects

@dataclass(frozen=True, slots=True)
class ConfigLoaderStats()

Represents the current in-memory snapshot state for observability surfaces.

load_config

def load_config() -> ConfigSnapshot

Load configuration based on the current INFRA environment variable.

get_config

def get_config() -> ConfigSnapshot

Return the current configuration snapshot, loading or refreshing when needed.

get_config_for_label

def get_config_for_label(label: str) -> ConfigSnapshot

Return a configuration snapshot for the given Azure App Configuration label.

Only DEVELOPMENT and PRODUCTION labels are accepted. Unknown labels fall back to the default snapshot. In local/non-azure mode the label is ignored and the standard :func:get_config snapshot is returned, since the local JSON file has no concept of labels.

get_config_value

def get_config_value(key: str) -> str | None

Get a single configuration value by key.

get_config_section

def get_config_section(prefix: str) -> ConfigSnapshot

Get all config values whose keys start with the provided section prefix.

refresh_config

def refresh_config() -> ConfigSnapshot

Force-refresh configuration and return the latest snapshot.

get_config_stats

def get_config_stats() -> ConfigLoaderStats

Return a detached snapshot of in-memory configuration loader state.

update_config_value

def update_config_value(key: str, value: str) -> bool

Update a single key in the in-memory config snapshot.

Returns True if the key already existed, False if it was newly created. The change is ephemeral — it is lost on process restart.

extract_features

def extract_features(config: Mapping[str, str],
feature_ids: Sequence[str]) -> FeatureSnapshot

Extract feature flag states for the given IDs from a config snapshot.

The platform supports two conventions:

  1. FeatureManagement:<id> with string boolean values.
  2. .appconfig.featureflag/<id> with Azure App Configuration JSON payloads.

When a feature is not configured, the result defaults to False so callers always receive a full feature map for the registered IDs.

// was this page useful?