Skip to content

Commit

Permalink
feat(api) list of enabled plugins on plugins/enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Aug 31, 2015
1 parent 0fa2b1c commit d206414
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Old route New route

The old routes are still maintained but will be removed in upcoming versions. Consider them **deprecated**.

- Admin API:
- The route to retrieve enabled plugins is now under `/plugins/enabled`.
- The route to retrieve a plugin's configuration schema is now under `/plugins/schema/{plugin name}`.

#### Added

- Plugins migrations. Each plugin can now have its own migration scripts if it needs to store data in your cluster. This is a step forward to improve Kong's pluggable architecture. [#443](https://github.com/Mashape/kong/pull/443)
Expand Down
4 changes: 4 additions & 0 deletions UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ Old route New route

The old routes are still maintained but will be removed in upcoming versions. Consider them **deprecated**.

- Admin API:
- The route to retrieve enabled plugins is now under `/plugins/enabled`.
- The route to retrieve a plugin's configuration schema is now under `/plugins/schema/{plugin name}`.

## Update to Kong `0.4.2`

The configuration format for specifying the port of your Cassandra instance changed. Replace:
Expand Down
10 changes: 9 additions & 1 deletion kong/api/routes/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ return {
end
},



["/plugins/schema/:name"] = {
GET = function(self, dao_factory, helpers)
local ok, plugin_schema = utils.load_module_if_exists("kong.plugins."..self.params.name..".schema")
Expand Down Expand Up @@ -71,5 +73,11 @@ return {
DELETE = function(self, dao_factory)
crud.delete(self.plugin_conf, dao_factory.plugins)
end
}
}, ["/plugins/enabled"] = {
GET = function(self, dao_factory, helpers)
return helpers.responses.send_HTTP_OK {
enabled_plugins = configuration.plugins_available
}
end
},
}
11 changes: 11 additions & 0 deletions spec/integration/admin_api/plugins_routes_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ describe("Admin API", function()
spec_helper.stop_kong()
end)

describe("/plugins/enabled", function()
local BASE_URL = spec_helper.API_URL.."/plugins/enabled"

it("should return a list of enabled plugins on this node", function()
local response, status = http_client.get(BASE_URL)
assert.equal(200, status)
local body = json.decode(response)
assert.equal("table", type(body.enabled_plugins))
end)
end)

describe("/plugins/schema/:name", function()
local BASE_URL = spec_helper.API_URL.."/plugins/schema/key-auth"

Expand Down

0 comments on commit d206414

Please sign in to comment.