Achaius
Achaius

Reputation: 6124

How to create nested key/value folder in consul

Is there any options available to create multiple nested KEY/VALUE in consul using some static file. Now if any mistake happens I am recreating the entire folder from root. Is there any way, just to upload a file in single command need to create a key/value structure in consul.

Upvotes: 0

Views: 2169

Answers (1)

Mistriel
Mistriel

Reputation: 529

Currently Consul (ver 0.6.3) does not support such an option .

Yet you can easily do so by a script that :

  1. cat a properties file line by line, get key & value from each line.
  2. invoke consul curl command to put the value from the property file. E.g :

curl -X PUT -d 'yourValue' http://localhost:8500/v1/kv/$yourKey

  1. if $yourKey has backslashes you'll get hierarchy in consul.

Upvotes: 4

Related Questions