Skip to main content

default_audience_from_env

Function default_audience_from_env 

Source
pub fn default_audience_from_env() -> Result<String, Error>
Expand description

Resolves MICROMEGAS_DEFAULT_AUDIENCE – the audience a never-stamped row is read as – defaulting to DEFAULT_AUDIENCE when unset. Malformed ⇒ Err, so a typo fails startup rather than silently relabelling every legacy row.

Read once, by LakehouseContext, and handed to all read sites from there. Every role that materializes or queries the six global views builds a LakehouseContext, and the maintenance role is the one that bakes the resolved value into partitions – so a deployment that sets this knob on only some roles gets partitions labelled inconsistently. Changing it is not a routine operation: already-written partitions keep the value they were materialized under until they are regenerated.

This is not a per-caller query-side setting but a property of the lake’s contents. Two other code readers of the same variable fall back to this same unprefixed name: micromegas_auth::policy::default_audience_from_env, on the key-minting side, and the ingestion HTTP edge’s own call in serve_ingestion, which resolves the default a credential with no bound audience is stamped with at write time. Trimming and its warning match both, so one env value can never be accepted by one role and rejected by another.