Example client implementation and template parser for confmgr
conftpl -u http://confmgr:8080 -s somestringkey
conftpl -u http://confmgr:8080 -s somehash/field
conftpl -u http://confmgr:8080 -s somelist/index/0
conftpl -u http://confmgr:8080 -t my_template.tmpl > my_template.output
Note: The "FILE" parameter will be replaced with the parsed template output file
conftpl -u http://confmgr:8080 -t some_xml.tmpl -v -- xmllint --format FILE > some_xml.xml
go get github.com/moensch/confmgr/cmd/conftpl
go get github.com/moensch/confmgr/cmd/confadm
- key "keyName" "defaultValue"
- Gets a given key, optionally fall back to default value
- Use "keyName/field" to retrieve hash fields
- Use "keyName/index/n" to retrieve a list item
- keyd "keyName" "defaultValue"
- Same as the above, but it will return a hash with "Value" and "Source" to show value origin
- list "keyName"
- Retrieve a list
- listd "keyName"
- Same as the above, but each list item will be a hash with "Value" and "Source"
- listj "keyName" "joinChar"
- Retrieve a list, but return as a string, joined by "joinChar"
- hash "keyName"
- Retrieve a hash
- Always sets "Source" hash key
Hello: {{key "name" "Stranger"}}
{{with keyd "name" "Stranger"}}
Hello {{.Value}} (key stored at {{.Source}}
{{end}}
{{range list "people"}}
Hello {{.}}
{{end}}
{{range listd "people"}}
Hello {{.Value}} (From: {{.Source}})
{{end}}
I welcome the following people: {{listj "people" ", "}}
{{range hash "db_settings"}}
<!-- From: {{.Source}} -->
<attr key='{{.Key}}' val='{{.Value}}'/>{{end}}