I have a templating system designed along this lines
It is a templating system where template values of the kind
param1=value2
param2=value2
go into templates of the type
do this with {{param1}}, do that with {{param2}}
etc.
Currently the params are in a database structured along the lines
param : the actual param as above
description: some description of what it does
default: default value
label: Label to use when values are entered in a form
required: required
the templates are also stored in a database
template: text of template
executeable: is it meant to be executed
destination: where it will be stored, includes remote locations
delete_after: it will be deleted
The templates have a number of other attributes but I have excluded them here
Note that destination can contain template parameters as well.
I am looking for way to restructure it so that it could all be included in a single file, ie the templates and their associated parameters could be elements of a struct (which I assume would be similar to records or structs in other languages) and once the params had been set, the templates would be filled out and ready to be delivered and/or executed as desired. A key part is wanting to use heredocs to set the body of the templates, making the heredoc values one the elements of the structures.
In the finished item the parameters would be entered from a form with the option of persisting some of them into a database.
So I am looking at 2 lists. The list of params and a list of templates. I would like to use iex initially and a web form later to enter the parameters and apply them to the templates, which will result in the template outputs with can go into temporary files, which a bash script can copy to the destinations and execute them via ssh
commands or locally.
Another thing I want to consider is if some of the parameters can be generated via code, such as temporary files names where the templates will be saved before being copied to the final destinations.
Any ideas?
Thanks!