Skip to content

Commit

Permalink
use /kms, read all without dir indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
kingluo committed Nov 28, 2022
1 parent 128b88d commit 512c7f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apisix/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ return {
["/protos"] = true,
["/plugin_configs"] = true,
["/consumer_groups"] = true,
["/kms/vault"] = true,
["/kms"] = true,
},
STREAM_ETCD_DIRECTORY = {
["/upstreams"] = true,
Expand Down
12 changes: 9 additions & 3 deletions apisix/core/etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,14 @@ _M.kvs_to_node = kvs_to_node
local function kvs_to_nodes(res)
res.body.node.dir = true
res.body.node.nodes = setmetatable({}, array_mt)
for i=2, #res.body.kvs do
res.body.node.nodes[i-1] = kvs_to_node(res.body.kvs[i])
if res.body.kvs[1].value then
for i=1, #res.body.kvs do
res.body.node.nodes[i] = kvs_to_node(res.body.kvs[i])
end
else
for i=2, #res.body.kvs do
res.body.node.nodes[i-1] = kvs_to_node(res.body.kvs[i])
end
end
return res
end
Expand Down Expand Up @@ -268,8 +274,8 @@ function _M.get_format(res, real_key, is_dir, formatter)
if string.byte(res.body.node.key, -1) == 47 then
res.body.node.key = string.sub(res.body.node.key, 1, #res.body.node.key-1)
end
res = kvs_to_nodes(res)
end
res = kvs_to_nodes(res)
end

res.body.kvs = nil
Expand Down

0 comments on commit 512c7f4

Please sign in to comment.