Skip to main content

materialise_kv_namespace_ids

Function materialise_kv_namespace_ids 

Source
pub fn materialise_kv_namespace_ids(
    text: &str,
    ids: &BTreeMap<String, String>,
) -> Result<String, String>
Expand description

Materialise deploy-time KV namespace ids in a generated wrangler.toml’s text, structurally, by binding (S4b, #1967). Each [[kv_namespaces]] entry whose binding has an id in ids, and whose id is currently exactly that binding’s placeholder (kv_id_placeholder), gets the id; the decor around the value (the # set at deploy time note) is kept.

Any other state — no [[kv_namespaces]] section, an entry already materialised, a binding ids doesn’t name — is left alone, and when nothing changes text is returned unchanged (byte-for-byte: the document is never re-serialised in that case, so there’s nothing for a caller to mistake for a real write). It is not a general “overwrite with the given id” operation: re-provisioning is a different feature (#1305’s Decision B).