Skip to content

Commit

Permalink
style(secret): _M.get and test case
Browse files Browse the repository at this point in the history
  • Loading branch information
HuanXin-Chen committed Aug 27, 2024
1 parent cb26bb8 commit b9d317c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 1 addition & 5 deletions apisix/secret/aws.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ local function make_request_to_aws(conf, key)
end

-- key is the aws secretId
local function get(conf, key)
function _M.get(conf, key)
core.log.info("fetching data from aws for key: ", key)

local idx = find(key, '/')
Expand Down Expand Up @@ -131,9 +131,5 @@ local function get(conf, key)
return data[sub_key]
end

_M.get = get


return _M


7 changes: 5 additions & 2 deletions t/secret/aws.t
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,11 @@ GET /t

local secret = require("apisix.secret")
local value = secret.fetch_by_uri("$secret://aws/mysecret/jack/key")
ngx.say(value)
if value then
ngx.say("secret value: ", value)
end
ngx.say("all done")
}
}
--- response_body
nil
all done

0 comments on commit b9d317c

Please sign in to comment.