Skip to main content

render_daemon_templates

Function render_daemon_templates 

Source
pub fn render_daemon_templates(
    config: &mut PitchforkTomlDaemon,
    context: &mut TemplateContext,
    top_env: Option<&IndexMap<String, String>>,
) -> Result<(), RenderError>
Expand description

Render all template-enabled fields of a daemon config.

Top-level env (from [env] in pitchfork.toml) is merged into the daemon’s own env as defaults — per-daemon values win on key conflicts. Env values are rendered first (with a context that excludes env itself, preventing self-reference cycles), then the rendered env is exposed as {{ env.X }} for the remaining fields (run, hooks, ready_*).

Modifies the config in place. Returns the first error encountered from non-hook fields (run, env, ready_*). Hook template errors are logged as warnings and the hook is set to None — hooks are re-rendered at fire time via fire_hook, so pre-rendered hook strings are unused.