If you need to get all the keys from the branch of Consul and put in .ini
file:
[service]
{{range tree "path/to/service"}}{{.Key | replaceAll "/" "." }}={{.Value}}
tree
get all keys by path.range
get access to{{.Key}}
and{{.Value}}
constructions.{{.Key | replaceAll "/" "." }}
- replace all/
in path to nested keys in dir (path/to/service
) to.
.
For expamle,
path/to/service/key
path/to/service/dir/key
path/to/service/dir/dir/key
wil be replace to
[service]
key=foo
dir.key=bar
dir.dir.key=baz