本文介绍了领事HTTP请求以获取所有kv值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用http api获取所有 consul kv值.目前,我可以使用以下命令获得一个值.

I need to get all the consul kv values using http api. Currently I can get the one value with the following command.

curl -k -X GET https://consul.banuka1.us-east-2.test:8543/v1/kv/banuka-test/test-value?token=1995-08-18

它仅返回其中指定的值( test-value )

it returns only the value specified in it (test-value)

但是我想获取 kv商店

But I want to get all the values in the kv store

我该怎么做?这里有解决方法吗?

How can I do this? Is there a workaround here?

注意:我已经使用 consul cli完成了此操作,但是我想使用 https api

NOTE: I have already done this using consul cli but I want to do this with https api

推荐答案

通过使用 recurse = true 查询参数.

You can simplify this and reduce the number of API calls by using the recurse=true query argument.

curl http://127.0.0.1:8500/v1/kv/\?recurse=true | jq -r '.[].Value | @base64d'

这篇关于领事HTTP请求以获取所有kv值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:58
查看更多