edge-router.example.toml can't be run directly: ${...} expansion runs over comments #15
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Found during the Network Access Control feature work. Pre-existing, not introduced by that feature.
Problem
ROUTES_CONFIG=edge-router.example.toml cargo runfails at startup withEnvironment variable 'ER_VAR_NAME' is not set.Root cause:
expand_env_refsinsrc/routes_config.rsdoes raw-text${...}substitution over the entire file content, including comments, beforetoml::from_strever parses it. The example file's TLS-section documentation comments contain literal${VAR_NAME}/${CF_TOKEN}tokens (as illustrative syntax), so expansion tries to resolve them as real env vars and aborts.Consequence: the shipped example file can't be run verbatim, only after a user copies and customizes it — which is the intended workflow, but the failure mode is a confusing hard error rather than anything pointing at "this is a template".
Proposed fix
Make
${...}expansion comment-aware (skip#-comment regions), or perform expansion after TOML parse on string values only rather than raw file text. Either keeps the documented${...}syntax in comments intact while still expanding real values.Severity
Minor — the example is a template meant to be copied first; no runtime/security impact on a real deployment. Filed so the example is runnable-as-shipped for anyone who tries it directly. (A one-paragraph networking note was already added to the example in commit
b728117; this expansion issue is separate.)