Expand description
Decoders that turn a raw environment-variable string into the JSON shape a schema leaf declares. Decode a raw environment-variable string into the JSON shape the schema declares for a leaf.
The Datadog Agent turns an environment string into a typed value in one place
(insertNodeFromString): a registered per-key transformer when the schema names an
env_parser, otherwise a cast against the key’s default type. This module ports both halves so
ADP can build a resolved view of real JSON arrays, objects, numbers, and booleans at each
nested path, which a single ordinary deserialization then reads.
Supported splitting and delimiter behavior matches the Agent bug-for-bug (see the per-function notes, which cite the Agent source). Error handling deliberately diverges: the Agent logs a malformed value and substitutes an empty result, while this module propagates a hard error so the caller can reject the value instead of silently losing it.
One type is intentionally left as a string: a Duration leaf keeps its raw text and is parsed by
crate::duration_de at deserialize time, because a duration also arrives from the file (a Go
duration string) and from the Agent stream (integer nanoseconds), so that leaf must stay
shape-tolerant regardless of the environment.
Enums§
- EnvDecode
- How to decode a raw environment string into a JSON value for one leaf.
Functions§
- decode
- Decodes
rawinto the JSON valuehowprescribes.