Feature request: ability to post complete config files content as keys #383

Closed
pavel-odintsov opened this Issue Dec 7, 2013 · 3 comments

3 participants

@pavel-odintsov

Hello!

I plans to add complete files for apache/Bind/mysql into etcd. But it's so hard because I can't do it via curl/etcdctl.

My command did not working:
curl -L --upload-file /etc/bind/fastvps.ru http://ns1.fastvps.ru:4001/v2/keys/fastvps.ru_zone_test_1
{"action":"set","node":{"key":"/fastvps.ru_zone_test_1","dir":true,"modifiedIndex":40,"createdIndex":40}}

Can you add ability to upload file content as key? If u approve it, I can send patch.

@shoe

I believe this is outside the scope of etcd. However, curl can already do what you describe.

There are multiple ways, but here is one described in the man page for curl:

 name@filename
                 This  will  make  curl  load  data  from  the  given file
                 (including any newlines), URL-encode that data  and  pass
                 it  on  in  the  POST.  The  name part gets an equal sign
                 appended, resulting in name=urlencoded-file-content. Note
                 that the name is expected to be URL-encoded already.

So, your example would be something like:

curl -X PUT  http://ns1.fastvps.ru:4001/v2/keys/fastvps.ru_zone_test_1 --data-urlencode value@/etc/bind/fastvps.ru_zone_test_1
@philips
CoreOS member

@shoe I will put that in the docs. Thanks.

@philips philips added a commit to philips/etcd that referenced this issue Feb 23, 2014
@philips philips feat(Documentation/api): document file upload
This gets asked about a lot int IRC/mailinglist/etc. Fixes this issue:
coreos#383 (comment)
02a053a
@philips
CoreOS member

This is now part of the docs. Closing via #596 . Thanks!

@philips philips closed this Feb 26, 2014
@ccding ccding added a commit that referenced this issue Mar 4, 2014
@philips philips feat(Documentation/api): document file upload
This gets asked about a lot int IRC/mailinglist/etc. Fixes this issue:
#383 (comment)
6309d28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment