consul-cfg is a set of utilities for managing app configurations with Consul and Consul template.
consul-cfg kv - Convert config formats like TOML, JSON, YAML etc to KV Pairs which can be bulk imported via consul cli. Output is same as JSON representation generated by the kv export command.
Export config file to Consul KV Pairs format which can be used for Consul bulk import.
# Read config from multiple files
consul-cfg kv --type toml config1.toml config2.toml
# Pipe stdin from other commands
cat config.toml | consul-cfg kv --type toml
# Specify prefix for all keys
cat config.toml | consul-cfg kv --type toml --prefix myconfig/appConvert config file to consul-template (go template). Config values replaced with consul-template keyOrUpdate syntax with default value as current value.
# Read config from multiple files
consul-cfg tmpl --type toml config1.toml config2.toml
# Pipe stdin from other commands
cat config.toml | consul-cfg tmpl --type toml
# Specify prefix for all keys
cat config.toml | consul-cfg tmpl --type toml --prefix myconfig/appCurrently following config formats are supported - toml, yaml, hcl, json and props (JAVA properties).
go install github.com/vividvilla/consul-cfgYou can download latest binary from releases based on your OS.
Array of maps are not supported by consul KV so it will be encoded as JSON string.