Skip to content

Commit

Permalink
Update kong/plugins/ai-proxy/handler.lua
Browse files Browse the repository at this point in the history
Co-authored-by: Keery Nie <[email protected]>
  • Loading branch information
tysoekong and windmgc committed Jul 29, 2024
1 parent 334df7f commit 8184ee0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions kong/plugins/ai-proxy/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,20 @@ local _KEYBASTION = setmetatable({}, {
local secret_key_set = plugin_config.auth and plugin_config.auth.aws_secret_access_key
or aws_config.global.AWS_SECRET_ACCESS_KEY

if access_key_set and secret_key_set then
aws = AWS({
-- if any of these are nil, they either use the SDK default or
-- are deliberately null so that a different auth chain is used
region = region,
})
aws = AWS({
-- if any of these are nil, they either use the SDK default or
-- are deliberately null so that a different auth chain is used
region = region,
})

if access_key_set and secret_key_set then
-- Override credential config according to plugin config, if set
local creds = aws:Credentials {
accessKeyId = access_key_set,
secretAccessKey = secret_key_set,
}

aws.config.credentials = creds
else
aws = AWS({
region = region,
})
end

this_cache[plugin_config] = { interface = aws, error = nil }
Expand Down

0 comments on commit 8184ee0

Please sign in to comment.