Filler is a simple tool to fill config templates using environment variables.
filler --src <directory> --ext <template_extension>
filler --src /etc --ext tpl
sample test.conf.tpl placed in /etc :
This is template file version {{ getEnv "VERSION" }}
- This sample command runs filler on /etc directory
- Filler will search for files with mask *.devops_template (recursively)
- Filler will find test.conf.devops_template
- Fills every action getEnv with value of defined variable name.
- Saves in file without template extension (in this case test.conf)
- Removes template files
Variable with array should looks like this:
ARRAY="golang,c,python,ruby""
Template file which use this array:
{{ range getEnvArray "ARRAY"}}{{ . }}
{{ end }}
Output file:
golang
c
python
ruby
{{ .ENV1 }}
{{ .ENV2 }}
{{ required .MISSING_ENV }}
If MISSING_ENV
is not set in the shell an error will be returned:
template: templateCli:2:17: executing "templateCli" at <required>: error calling required: ENV variable is missing
~~ .ENV1 ~~
filler --left-delim '~~' --right-delim '~~'
filler --in-place
- extension doesn't need to be provided