Custom Templates
Metlo supports writing custom templates using Typescript. You can write and test your templates locally and push them to Metlo using the CLI (Setup Instructions).
Setting Up Your Environment
The first step is to setup a node project to build your templates in. Be sure to have both Node and NPM installed before following these steps! We highly recommend using nvm.
After setting up your project install @metlo/testing
for the testing utility
functions.
Creating a New Template
Although you can structure your templates however you want, since templates can have different versions we recommend structuring your template repository like this (with folders for templates and typescript files for each version):
First create a folder called templates in your project:
After that create a folder inside it for your template, lets make a template
that verifies if an endpoint always responds with CSP Headers called
VERIFY_CSP_HEADERS
.
Now you can open v1.ts
in the editor of your choice and paste the following:
You can see a deeper overview of templates here.
Generating a Test
You can generate a test with this new template using the Metlo CLI.
Running Your Generated Test
First fill in any values you need in output.yaml
. After that, you can run the
generated test by running the following:
Pushing Your Templates to Metlo
After you’ve verified that the template works, you can push your template to Metlo by running:
This template should now be available in the Metlo UI.