Documentation
¶
Overview ¶
Package secrettmpl is the fleet's one path-placeholder templating engine — the angle-bracket <path:…> syntax with ignore-annotation semantics — so no tool hand-rolls its own placeholder scanner over secret-injection templates.
A template is arbitrary text with embedded placeholders of the form
<path:some/secret/path>
Render walks the template left-to-right and replaces each placeholder with the value returned by a Resolver for that path; all other text is copied verbatim. Two ignore-annotation forms suppress resolution so a literal "<path:…>" can survive into the output (for documentation, nested templates, or escaping):
- inline: <ignore:path:some/path> → renders the literal "<path:some/path>"
- block: <ignore> … </ignore> → every placeholder inside is left untouched (emitted verbatim, ignore tags stripped)
The scanner is a single pass with no backtracking; unterminated or malformed placeholders yield typed, code-carrying errors via errors-go. Pure stdlib + errors-go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render expands every <path:…> placeholder in template using resolver, honoring inline <ignore:path:…> and block <ignore>…</ignore> annotations. It returns the fully substituted string, or a typed code-carrying error on a malformed placeholder ("secrettmpl_unterminated" / "secrettmpl_empty_path") or a resolver failure ("secrettmpl_resolve").
Types ¶
type MapResolver ¶
MapResolver is a Resolver backed by a static map, the convenience form for fixed substitution sets and tests. A path absent from the map resolves to an "secrettmpl_unresolved" error.