Templating

Serverboards allows to use templates in various areas of the applicaiton.

Supported templating is very basic, allowing only to access elements in a dictionary or array, with no further processing.

Depending on the calling place the templating is performed at UI, backend or plugin, but all of them use the same syntax:

  • Variables are marked as {{variable_name}}
  • Objects can access to values by key: {{variable.key}} and prints the result
  • Arrays use numbers as access elements: {{array.0.key}}
  • The printed result is a string representation of the data

This is consistent with other widely known templating systems, as Django templates, Jinja, moustache and so on.

This does not allow to create any logic at the templates, but also prevents security issues that may result.

Only most important data is shown in this document. If you want to learn more about what specific data is rendered, trigger the rule manually and print the key; it will output a JSON string with the current data.

Here are listed some areas where templates can appear, and what data they receive.

Issue Open

The Issue Open action receives these elements and can be used on all parameters.

If it is executed out of the requested context, the data would be empty.

Key Content
aliases List of aliases of the rule
description Description of the rule
id id of the rule
rule Full rule data
rule.actions Dictionary with the actions by state name
rule.last_state Previous state
rule.serverboard Serverboard that contain this rule
state New state of the rule
service Related service data
service.config Service configuration
service.description Service description
service.name Related service name
service.uuid Service UUID
service.serverboards Serverboards on which this service appears
title Title of the rule
trigger Data from the trigger
url Full URL to access the rule