Skip to main content

Module env_config

Module env_config 

Source
Expand description

Build a PipelineConfig from a snapshot of FAUCET_* environment variables.

The public surface is intentionally split between pure functions (taking a HashMap<String, String> env snapshot — fully testable) and a thin shell from_process_env() that captures std::env::vars().

See cli/README.md and issue #42 for the user-facing variable schema.

Functions§

build_named_sinks
Same as build_named_sources but for sinks via FAUCET_SINKS_<NAME>_*.
build_named_sources
Harvest named source templates from FAUCET_SOURCES_<NAME>_TYPE selectors and FAUCET_SOURCES_<NAME>_<FIELD> config fields. <NAME> is lowercased.
build_pipeline_config
Construct a complete PipelineConfig from an env snapshot.
build_sink
Construct the sink ConnectorSpec from FAUCET_SINK + FAUCET_SINK_<KIND>_*.
build_source
Construct the source ConnectorSpec from FAUCET_SOURCE + FAUCET_SOURCE_<KIND>_*.
build_state
Construct an optional StateStoreSpec from FAUCET_STATE + FAUCET_STATE_<KIND>_*. Returns Ok(None) when FAUCET_STATE is unset or empty (the common case).
build_transforms
Construct an ordered Vec<TransformSpec> from FAUCET_TRANSFORM_<N> selectors and FAUCET_TRANSFORM_<N>_<FIELD> config fields. Indices must be contiguous starting at 1; any gap is an error so a misnumbered var never silently drops a transform.
build_vars
Harvest FAUCET_VARS_<KEY> into the top-level vars map. Returns None when no FAUCET_VARS_* variables are set.
extract_scope
Walk every env var starting with prefix, strip the prefix, lowercase the remainder into a field name, apply the _JSON precedence rule, and assemble a Value::Object. Returns the object verbatim — no shape validation; the connector’s own Deserialize impl is the gate.
from_process_env
Snapshot std::env::vars() and call build_pipeline_config.