Variable resolution
Floe supports a three-source variable system that lets you inject environment-specific values into config files without editing the config itself.
Sources and precedence
Section titled “Sources and precedence”Variables are collected from three sources and merged before any placeholder substitution occurs. When the same key appears in more than one source the highest-precedence value wins:
config variables > env file variables > profile variables (highest) (lowest)| Source | Where defined | Precedence |
|---|---|---|
| Config variables | env.vars: block in the main Floe YAML config |
Highest |
| Env file variables | YAML map loaded from env.file: in the main Floe YAML config |
Mid |
| Profile variables | variables: block in the environment profile |
Lowest |
Placeholder syntax
Section titled “Placeholder syntax”In variable values — ${VAR}
Section titled “In variable values — ${VAR}”Variable values may themselves reference other variables using the
${VAR} syntax:
variables: BASE_PATH: /data/prod INCOMING: ${BASE_PATH}/incoming # expands to /data/prod/incoming OUTPUT: ${BASE_PATH}/output # expands to /data/prod/outputReferences are resolved recursively — a value may reference a variable
whose value also contains ${…} placeholders — up to the built-in depth
limit (32 levels).
In config fields — {{VAR}}
Section titled “In config fields — {{VAR}}”Once all variables are fully resolved, Floe substitutes them into the
main config using the {{VAR}} (double-brace) syntax:
entities: - name: customers source: format: csv path: "{{INCOMING}}/customers.csv" sink: accepted: format: parquet path: "{{OUTPUT}}/customers.parquet"Resolution rules
Section titled “Resolution rules”- Merge – build a single map from all three sources, higher-priority sources overwriting lower ones.
- Expand – for every variable value, substitute
${KEY}with the fully-resolved value ofKEY, recursively. - Fail-fast – any placeholder that cannot be resolved or forms a cycle produces an immediate, actionable error before the run begins.
Fail-fast errors
Section titled “Fail-fast errors”| Situation | Error (example) |
|---|---|
| Reference to undefined variable | variable "${MISSING}" is referenced but not defined |
| Unclosed placeholder | variable "PATH": unclosed placeholder in value '/data/${UNCLOSED' |
| Empty placeholder | variable "VAR": empty placeholder ${} |
| Circular reference | circular variable reference detected: A -> B -> A |
| Depth limit exceeded | variable expansion exceeded maximum depth (32) |
Examples
Section titled “Examples”Simple value override
Section titled “Simple value override”variables: ENV: dev CATALOG: dev_catalog
# profiles/prod.ymlvariables: ENV: prod CATALOG: prod_catalogNested references
Section titled “Nested references”variables: ROOT: /mnt/data ENV: prod BASE: ${ROOT}/${ENV} # → /mnt/data/prod INCOMING: ${BASE}/incoming # → /mnt/data/prod/incoming OUTPUT: ${BASE}/output # → /mnt/data/prod/outputCross-source reference
Section titled “Cross-source reference”A config variable can reference a value supplied by the profile:
variables: CATALOG: polaris_prod
# config.ymlenv: vars: TABLE: "{{CATALOG}}.bronze.customers" # CATALOG comes from the profile at runtimeSee also: Environment profiles for the full profile schema.
Synced from floe @ v1.1.0 (313b534), docs/guides/variables.md.