Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for copy/paste, export/import of K/V store folders in Consul native UI #1593

Closed
quickwind opened this issue Jan 13, 2016 · 7 comments
Labels
type/enhancement Proposed improvement or new feature

Comments

@quickwind
Copy link

Hi,

We are using Consul extensively in our project, including using it for our service centralized configuration management via Consul K/V store. We don't yet developed our own UI for configuration management but just use Consul embedded UI for configuration changes. We found it is cumbersome to add the K/V pairs one by one, especially we are separating the services' configuration in different folders.

It would be really great if Consul UI could support copy and paste a whole directory to a new directory (and even can select the keys to copy over), and also export/import the key-value pairs into/from a file.

@slackpad slackpad added the type/enhancement Proposed improvement or new feature label Jan 14, 2016
@slackpad
Copy link
Contributor

HI @quickwind thanks for opening an issue. Something like https://github.com/Cimpress-MCP/git2consul is probably a better way to go for this use case. We are thinking of adding a multi-KV API, but we don't have plans to add that to the UI at this time.

@yotamofek
Copy link

Since this shows up on google, and since I've spent the last 3 hours trying to accomplish a recursive copy of a KV directory, I'll post my terrible bash script here:

curl http://consul.mycompany.com/v1/kv/$FROM\?recurse 2>/dev/null |
jq -r '.[] | [.Key, .Value] | join(" ")' |
while read line; do
    KEY=$(echo $line | awk '{print $1}' | sed "s/$FROM/$TO/")
    VAL=$(echo $line | awk '{print $2}' | base64 --decode)
    curl -XPUT -d "$VAL" "http://consul.mycompany.com/v1/kv/$KEY"
    echo
done;

Set $FROM and $TO to the absolute paths, and change the URL for your consul server.

Caveat: jq >= 1.4 must be installed on your system.

Hope this helps someone.

@jsr88f
Copy link

jsr88f commented Mar 31, 2016

Is there a way to have consul load key/value from /etc/consul.d/somefile.json, similar how it can load service config ?

@slackpad
Copy link
Contributor

@jsr88f there's currently no way to statically configure keys similar to service definitions. Take a look at git2consul referenced above - it can load KV data based on input files.

@vagharsh
Copy link

vagharsh commented Jul 4, 2017

hey guys i have written an application that is basically a tree for consul kv store which support cut, copy, paste, delete , create functions, check it out and let me know if it helps

https://github.com/vagharsh/consul-tree

@maxadamo
Copy link

maxadamo commented Jan 24, 2018

@vagharsh honestly I don't have enough will to configure apache + php, but it looks very nice.

@vagharsh
Copy link

you could use the docker ready-made docker container and not configure anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Proposed improvement or new feature
Projects
None yet
Development

No branches or pull requests

6 participants