Skip to content

Commit

Permalink
use has_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
soulbird committed Nov 24, 2022
1 parent e0a456d commit 778e9a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apisix/core/env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ end


local function is_env_ref(ref)
return type(ref) == "string" and sub(upper(ref), 1, 7) == ENV_PREFIX
-- Avoid the error caused by has_prefix to cause a crash,
-- so judge the type of ref.
return type(ref) == "string" and string.has_prefix(upper(ref), ENV_PREFIX)
end


Expand Down
3 changes: 2 additions & 1 deletion apisix/core/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ local base = require("resty.core.base")
local open = io.open
local sub_str = string.sub
local str_byte = string.byte
local str_format = string.format
local tonumber = tonumber
local tostring = tostring
local pairs = pairs
Expand Down Expand Up @@ -352,7 +353,7 @@ do
end

local function retrieve(refs)
log.info(string.format("retrieve secrets refs: %p", refs))
log.info(str_format("retrieve secrets refs: %p", refs))

local new_refs = table.deepcopy(refs)
return retrieve_ref(new_refs)
Expand Down

0 comments on commit 778e9a9

Please sign in to comment.