Skip to content

Commit

Permalink
style(*): rename var
Browse files Browse the repository at this point in the history
  • Loading branch information
windmgc committed Jul 9, 2024
1 parent 6df34cf commit 8611392
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions kong/pdk/vault.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local decode_json = cjson.decode
local NEGATIVELY_CACHED_VALUE = "\0"
local ROTATION_INTERVAL = tonumber(os.getenv("KONG_VAULT_ROTATION_INTERVAL"), 10) or 60
local SECRETS_RETRY_KEY_PREFIX = "retry_count:"
local SECRETS_RETRY_COUNT_THRESHOLD = tonumber(os.getenv("KONG_VAULT_SECRETS_RETRY_COUNT_THRESHOLD"), 10) or 60
local SECRETS_ROTATION_MAX_RETRIES = tonumber(os.getenv("KONG_VAULT_SECRETS_ROTATION_MAX_RETRIES"), 10) or 60
local DAO_MAX_TTL = constants.DATABASE.DAO_MAX_TTL


Expand Down Expand Up @@ -1284,12 +1284,12 @@ local function new(self)
local ok, err = get_from_vault(reference, strategy, config, new_cache_key, parsed_reference)
if not ok then
local retry_count = tonumber(SECRETS_CACHE:get(SECRETS_RETRY_KEY_PREFIX .. new_cache_key) or 0, 10)
-- secrets that are failed resolving for more than SECRETS_RETRY_COUNT_THRESHOLD
-- secrets that are failed resolving for more than SECRETS_ROTATION_MAX_RETRIES
-- times will be removed from the cache and stop rotation
if retry_count >= SECRETS_RETRY_COUNT_THRESHOLD then
if retry_count >= SECRETS_ROTATION_MAX_RETRIES then
SECRETS_CACHE:delete(new_cache_key)
SECRETS_CACHE:delete(SECRETS_RETRY_KEY_PREFIX .. new_cache_key)
return nil, fmt("could not retrieve value for reference %s (%s) after %d retries, removing from cache and stop rotation", reference, err, SECRETS_RETRY_COUNT_THRESHOLD)
return nil, fmt("could not retrieve value for reference %s (%s) after %d retries, removing from cache and stop rotation", reference, err, SECRETS_ROTATION_MAX_RETRIES)

else
SECRETS_CACHE:incr(SECRETS_RETRY_KEY_PREFIX .. new_cache_key, 1, 0)
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/13-vaults/07-resurrect_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("vault resurrect_ttl and rotation (#" .. strategy .. ") #" .. vault.nam
lazy_setup(function()
helpers.setenv("KONG_LUA_PATH_OVERRIDE", LUA_PATH)
helpers.setenv("KONG_VAULT_ROTATION_INTERVAL", "1")
helpers.setenv("KONG_VAULT_SECRETS_RETRY_COUNT_THRESHOLD", "2")
helpers.setenv("KONG_VAULT_SECRETS_ROTATION_MAX_RETRIES", "2")

vault:setup()
vault:create_secret(secret, "init")
Expand Down

0 comments on commit 8611392

Please sign in to comment.