Module env_overlay

Module env_overlay 

Source
Expand description

Relocates underscore-joined environment keys into the nested Datadog configuration shape. Overlay flat environment-variable keys onto the nested Datadog configuration shape.

Environment variables reach the config map as flat, underscore-joined top-level keys: DD_AUTOSCALING_FAILOVER_ENABLED lands as autoscaling_failover_enabled, not as the nested autoscaling.failover.enabled object. DatadogConfiguration deserializes the nested shape, so it never reads those flat keys and the value is silently lost.

The by-key configuration view can resolve a dotted path from its underscore-joined form. The typed path deserializes the whole structure at once, so it needs the same relocation performed before deserialization. This module applies that one-time pass over the merged value, driven by the generated table of supported multi-segment keys ([ENV_OVERLAY_KEYS]): for each known dotted path, it relocates any matching flat key into the nested slot the deserializer reads.

The relocation runs the safe, unambiguous direction (known path to its single flat form), so it never has to guess where the underscores in an arbitrary flat key are nesting boundaries.

This pass only relocates; it never reshapes the value. A flat env value is moved verbatim, even for string lists: DatadogConfiguration’s string-list leaves deserialize with a shape-tolerant reader (see the generated crate’s list_de) that splits a space-separated env string into a sequence. Keeping shape at the deserializer means this table needs to know only the path, not the type.

Structs§

EnvOverlayKey
One supported Datadog key: the flat env forms that reach it and its nested path.

Enums§

EnvOverlayMode
How a flat environment value relates to the value already in the nested slot.

Functions§

apply_env_overlay
Relocates flat environment-variable keys in merged into the nested slots the Datadog deserializer reads, according to mode.