Skip to content

Commit

Permalink
style(secret): remove some tips
Browse files Browse the repository at this point in the history
  • Loading branch information
HuanXin-Chen committed Sep 11, 2024
1 parent 0f53faa commit cdcd661
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions apisix/secret/gcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ local function get_secret(oauth, secrets_id)
end


local function make_request_to_gcp(conf, secrets_id)
local function request_to_gcp(conf, secrets_id)
local auth_config, err = fetch_oauth_conf(conf)
if not auth_config then
return nil, err
Expand Down Expand Up @@ -174,11 +174,11 @@ function _M.get(conf, key)
return nil, "can't find main key, key: " .. key
end

local sub_key = idx and str_sub(key, idx + 1) or nil
local sub_key = idx and str_sub(key, idx + 1)

core.log.info("main: ", main_key, sub_key and ", sub: " .. sub_key or "")

local res, err = make_request_to_gcp(conf, main_key)
local res, err = request_to_gcp(conf, main_key)
if not res then
return nil, "failed to retrtive data from gcp secret manager: " .. err
end
Expand All @@ -189,7 +189,7 @@ function _M.get(conf, key)

local data, err = core.json.decode(res)
if not data then
return nil, "failed to decode result, res: " .. res .. ", err: " .. err
return nil, "failed to decode result, err: " .. err
end

return data[sub_key]
Expand Down
1 change: 1 addition & 0 deletions apisix/utils/google-cloud-oauth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function _M.generate_jwt_token(self)
aud = self.token_uri,
scope = self.scope,
iat = get_timestamp(),
--- access token lifetime : 60 * 60
exp = get_timestamp() + (60 * 60)
})

Expand Down
2 changes: 1 addition & 1 deletion t/secret/gcp.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ run_tests;

__DATA__

=== TEST 1: sanity
=== TEST 1: sanity: validate different schema situation
--- config
location /t {
content_by_lua_block {
Expand Down

0 comments on commit cdcd661

Please sign in to comment.