Skip to main content

Module template

Module template 

Source
Expand description

Tera template rendering for pitchfork.toml configuration fields.

Allows run, env values, hooks.*, the readiness fields (ready_cmd, ready_http, ready_port, ready_output), and the health check fields (health_cmd, health_http, health_port) to use Tera templates like {{ daemons.redis.ports[0] }} to reference computed values from other daemons.

Templates are resolved level-by-level along the dependency order: each level can reference daemons from previous levels (which have already started and had their ports resolved).

Structs§

DaemonTemplateState
Resolved state of a daemon available for template rendering.
TemplateContext
Context for rendering Tera templates in pitchfork.toml fields.

Enums§

RenderError

Constants§

TEMPLATE_CONTEXT_ENV
Environment variable carrying the template context to the mise x wrapper of a daemon whose command it has to finish rendering.

Functions§

daemon_env_with_files
The daemon’s own env with its env_file variables underneath: inline env wins over the files, and later files win over earlier ones. Relative paths resolve from the project directory (the same base as dir), and missing files are skipped so a git-ignored .env.local stays optional.
render_daemon_templates
Render all template-enabled fields of a daemon config.
render_env
Merge top-level and per-daemon env, render template values, and return the rendered env. Used by hook rendering where the daemon config is not mutated.
render_template
Render a Tera template string with the given context.