Skip to main content

config.catalog

Central target indexes and single-config registry for exp configuration contracts.

The module exposes two related concepts:

  1. Target indexes for the build-time and run-time endpoints.
  2. A config registry describing every individual key that the /api/v1/config endpoint is allowed to serve.

Both structures are derived from one source of truth so the endpoint behavior, documentation, and authorization rules stay aligned.

ConfigKeyDocumentation Objects

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

Human-readable metadata for a single configuration key.

ConfigResolutionResult Objects

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

Represents the resolved values for a target document request.

ConfigValueDefinition Objects

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

Describes one configuration key exposed by GET /api/v1/config.

ConfigValueResolution Objects

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

Represents the resolved value for a single configuration key.

TargetConfigIndex Objects

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

Describes the indexed config documents for one exp consumer target.

build_time_keys

@property
def build_time_keys() -> ConfigKeys

Return the build-time config keys in stable order.

runtime_keys

@property
def runtime_keys() -> ConfigKeys

Return the run-time config keys in stable order.

indexed_keys

@property
def indexed_keys() -> ConfigKeys

Return every config key indexed for this target.

build_time_version

@property
def build_time_version() -> str

Return the version hash for the build-time config document.

runtime_version

@property
def runtime_version() -> str

Return the version hash for the run-time config plus feature document.

get_target_index

def get_target_index(target: str) -> TargetConfigIndex | None

Return the indexed configuration document definition for a target.

get_config_definition

def get_config_definition(name: str) -> ConfigValueDefinition | None

Return metadata for a single configuration key served by /api/v1/config.

get_config_registry

def get_config_registry() -> dict[str, ConfigValueDefinition]

Return a shallow copy of the complete single-config registry.

get_refresh_interval_for_targets

def get_refresh_interval_for_targets(targets: Sequence[str]) -> int

Return the maximum refresh interval declared by the supplied targets.

resolve_build_time_config

def resolve_build_time_config(
index: TargetConfigIndex,
config_snapshot: ConfigSnapshot) -> ConfigResolutionResult

Resolve build-time config values for the provided target index.

resolve_runtime_config

def resolve_runtime_config(
index: TargetConfigIndex,
config_snapshot: ConfigSnapshot) -> ConfigResolutionResult

Resolve run-time config values for the provided target index.

resolve_config_value

def resolve_config_value(
definition: ConfigValueDefinition,
config_snapshot: ConfigSnapshot) -> ConfigValueResolution

Resolve one indexed configuration value from the current config snapshot.

Feature flag keys are stored in the snapshot with a FeatureManagement: prefix but registered in the catalog under their bare name. This function checks both the bare key and the prefixed key so callers can request website.commander.enabled regardless of how the underlying store labels the entry.

// was this page useful?