Skip to content

Commandline utility to convert config formats like TOML, JSON, YAML etc to KV Pairs which can be imported via consul cli.

License

Notifications You must be signed in to change notification settings

vividvilla/consul-cfg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

consul-cfg

consul-cfg is a set of utilities for managing app configurations with Consul and Consul template.

Commands

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.

Get started

Config to KV Pairs

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/app

Config to consul-template

Convert 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/app

Supported formats

Currently following config formats are supported - toml, yaml, hcl, json and props (JAVA properties).

Install

Install using go install

go install github.com/vividvilla/consul-cfg

Install binary

You can download latest binary from releases based on your OS.

Caveat

Array of maps are not supported by consul KV so it will be encoded as JSON string.

About

Commandline utility to convert config formats like TOML, JSON, YAML etc to KV Pairs which can be imported via consul cli.

Resources

License

Stars

Watchers

Forks

Packages

No packages published