AirHelp / filler

0 stars 1 forks source link

Add map support (getEnvMap) #5

Closed marcin-janas closed 5 years ago

marcin-janas commented 5 years ago

Signed-off-by: Marcin Janas marcin.janas@airhelp.com

Description: I need this functionality to generate a logstash configuration for cloudwatch (zulu influxdb)

=== RUN   TestSearchAndFill
--- PASS: TestSearchAndFill (0.00s)
PASS
coverage: 78.8% of statements
ok      github.com/AirHelp/filler/templates     0.007s  coverage: 78.8% of statements
=== RUN   TestGet
--- PASS: TestGet (0.00s)
PASS
coverage: 100.0% of statements
ok      github.com/AirHelp/filler/version       0.002s  coverage: 100.0% of statements
go build
echo '{{ getEnv "TEST1" }}' > test/output/a.conf.tpl
echo '{{ getEnv "TEST2" }}' > test/output/b.conf.tpl
echo '{{ getEnv "TEST2" }}' > test/output/c.conf.tpl_new
echo '{{ getEnv "TEST1" }}' > test/output/d.conf.tpl_single
echo '{{ range getEnvArray "ARRAY"}}{{.}}{{ end }}' > test/output/e.conf.tpl_array
echo '{ {{ range getEnvArray "KEYS" }}\n\t{\n\t\t"key": "{{ . }}",\n\t\t"value": "{{ getEnvMap "MAP" . }}",\n\t},{{ end }}\n}' > test/output/m.conf.tpl_map
bats test/bats/tests.bats
 ✓ Check that the filler binary is available
 ✓ help
 ✓ version
 ✓ filler-run-without-ext
 ✓ filler-run-with-ext
 ✓ filler-run-with-single-file
 ✓ filler-run-with-missing-var
 ✓ filler-run-with-delete
 ✓ filler-run-with-array
 ✓ filler-run-with-map

10 tests, 0 failures