Skip to main content

Module bind

Module bind 

Source
Expand description

Binding ${param.NAME} references to supplied values (#444).

Binding is a pre-parse pass over the untyped config document, run after ${env:} / ${file:} / ${secret:} interpolation and before the typed PipelineConfig deserialise. Two consequences worth stating, because both are load-bearing:

  1. Structure safety. Substitution happens per JSON/YAML scalar, exactly like crate::interpolate::interpolate_value — a supplied value holding :, a newline, or - stays the single scalar it replaced and can never inject a key or an array element. Downstream, SQL-bound and JSON-safe substitution paths (substitute_context_bind_params / substitute_context_json in faucet_core::util) are untouched, so the existing SQL/JSON-injection guarantees still hold for param-derived text.
  2. No re-interpolation of caller input. Env/file/secret directives are resolved before binding, so a supplied value is never itself scanned for directives. Belt and braces, a supplied value containing ${ is rejected outright: params are data, not directives.

When ${param.NAME} is a scalar’s entire text the declared type is preserved (an int param lands as a JSON number, not "5"); embedded in a longer string it is stringified, like every other interpolation namespace.

Structs§

BoundParams
The result of a bind: every declared param’s effective value, plus which of them are sensitive.

Enums§

BindMode
What to do with a required param the caller did not supply.

Constants§

PARAMS_KEY
The config key holding the declaration block.
PARAM_ID
The interpolation namespace params live in (${param.NAME}).

Functions§

bind_document
Bind params in an untyped config document, in place.
collect_cli_params
Collect a --param name=value list into a SuppliedParams map, rejecting a repeated name (silently keeping the last would be a footgun).
collect_env_overrides
Collect a --param-env NAME[=VALUE] list into an env overlay. A bare NAME takes the value from the caller’s own environment (so a secret never appears in the process arguments); NAME=VALUE sets it explicitly.
declared
Read the params: block out of an untyped config document, validating it. A document with no block yields an empty spec.
parse_cli_param
Parse a --param key=value CLI argument. The value is kept as a JSON string; spec::coerce converts it to the declared type at bind time.
resolve
Resolve every declared param to a value, without touching the document.

Type Aliases§

SuppliedParams
Caller-supplied values, keyed by param name. Values arrive either as real JSON (HTTP) or as strings (--param k=v); spec::coerce normalizes both.