Skip to content

Templating

In many places of the configuration Bifröst can not only be customized by using static strings or numbers, but by using templates as well.

Bifröst uses the template engine of Go. A collection of rather good resources to learn can be found at HashiCrop's Nomand Developer documentation.

In the documentation of each Bifröst's component you can find the type (like String Template or Bool Template) and the corresponding context object (like Connection or Authorization). The result will be like:

Variants

String

A template of type String is always rendered to a corresponding string - as it is.

Examples:

  • Foo{{ "Xyz" }}Bar or will result in FooXyzBar.
  • Foo{{ 123 }}Bar or will result in Foo123Bar.

Bool

A template of type Bool is always rendered into a boolean value (true or false). The following rules are evaluated to decide for either true or false:

  • false: If the value trimmed and converted to lower-cases is one of: false, disabled, 0, no, off, <empty>, nil or null
  • true: Everything else

Uint32

A template of type Uint32 is always rendered into an unsigned integer with 32 bits value (0 or more). An empty value is always assumed as 0.