Skip to content

Commit

Permalink
feat(runloop): added the workspace id into the plugin config in the p…
Browse files Browse the repository at this point in the history
…lugins iterator (Kong#13602)

the workspace id is needed in some cases, for example in the configure handler.

https://konghq.atlassian.net/browse/FTI-6200
  • Loading branch information
catbro666 authored and andrewgkew committed Sep 5, 2024
1 parent e7042d3 commit 4723a6e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/feat-plugin-conf-ws-id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Added the workspace id into the plugin config in the plugins iterator.
type: feature
scope: Core
1 change: 1 addition & 0 deletions kong/runloop/plugins_iterator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ local function get_plugin_config(plugin, name, ws_id)
cfg.consumer_id = plugin.consumer and plugin.consumer.id
cfg.plugin_instance_name = plugin.instance_name
cfg.__plugin_id = plugin.id
cfg.__ws_id = ws_id

local key = kong.db.plugins:cache_key(name,
cfg.route_id,
Expand Down
1 change: 1 addition & 0 deletions spec/02-integration/07-sdk/04-plugin-config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ describe("Plugin configuration", function()
local body = assert.status(200, res)
local json = cjson.decode(body)
assert.equal("test", json.plugin_instance_name)
assert.equal(kong.default_workspace, json.__ws_id)
end)
end)

0 comments on commit 4723a6e

Please sign in to comment.