Skip to content

Commit

Permalink
Docs: Added templating documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Oct 31, 2019
1 parent 47890a0 commit 827cd20
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/source/first-steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Test cases:
}
}
Hint: You can pass environment variables in parameters - see: :ref:`Templating` section.

4. Running checks
-----------------

Expand All @@ -90,7 +92,7 @@ The image will by default expose a HTTP endpoint.
List of supported environment variables:

- CHECK_INTERVAL="*/1 * * * *"
- CHECK_INTERVAL="\*/1 \* \* \* \*"
- WAIT_TIME=0
- LAZY=false

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Simple, easy to setup, easy to understand. Works perfectly with Docker.
first-steps
hooks
reference
templating
custom-scripts
cache

Expand Down
37 changes: 37 additions & 0 deletions docs/source/templating.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.. _Templating:

Templating
==========

In order to increase the security there is a `simple templating` mechanism that allows to inject variables into
parameters you define that are passed to the checks.

**Example:**

.. code:: yaml
{
"type": "ssh-command",
"input": {
"user": "thesecurityman",
"host": "iwa-ait.org",
"port": 6200,
"password": "${ENV.IWA_SECURITY_MAN_PASSWD}",
"command": "/usr/bin/some-security-check --is-secure",
"expected_exit_code": 0,
"timeout": 30
}
}
Reference table
---------------

+--------------+------------------------------+--------------------------------------------------+
| Pattern | Example | Description |
+==============+==============================+==================================================+
| ${ENV.*} | ${ENV.USER} | Injects an environment variable from the host |
+--------------+------------------------------+--------------------------------------------------+
| ${checkName} | http | Name of the currently executed check |
+--------------+------------------------------+--------------------------------------------------+
| ${date} | 2019-10-31T07:53:45.380307 | Current date and time |
+--------------+------------------------------+--------------------------------------------------+

0 comments on commit 827cd20

Please sign in to comment.