Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix(conf) load custom plugins property #1910

Merged
merged 1 commit into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kong/conf_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ local function load(path, custom_conf)
custom_plugins[plugin_name] = true
end
conf.plugins = tablex.merge(constants.PLUGINS_AVAILABLE, custom_plugins, true)
conf.custom_plugins = nil
setmetatable(conf.plugins, nil) -- remove Map mt
end

Expand Down
2 changes: 0 additions & 2 deletions spec/01-unit/02-conf_loader_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ describe("Configuration loader", function()
it("returns a plugins table", function()
local constants = require "kong.constants"
local conf = assert(conf_loader())
assert.is_nil(conf.custom_plugins)
assert.same(constants.PLUGINS_AVAILABLE, conf.plugins)
end)
it("loads custom plugins", function()
local conf = assert(conf_loader(nil, {
custom_plugins = "hello-world,my-plugin"
}))
assert.is_nil(conf.custom_plugins)
assert.True(conf.plugins["hello-world"])
assert.True(conf.plugins["my-plugin"])
end)
Expand Down
12 changes: 12 additions & 0 deletions spec/01-unit/03-prefix_handler_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ describe("NGINX conf compiler", function()
local in_prefix_kong_conf = assert(conf_loader(tmp_config.kong_conf))
assert.same(conf, in_prefix_kong_conf)
end)
it("writes custom plugins in Kong conf", function()
local conf = assert(conf_loader(nil, {
custom_plugins = { "foo", "bar" },
prefix = tmp_config.prefix
}))

assert(prefix_handler.prepare_prefix(conf))

local in_prefix_kong_conf = assert(conf_loader(tmp_config.kong_conf))
assert.True(in_prefix_kong_conf.plugins.foo)
assert.True(in_prefix_kong_conf.plugins.bar)
end)
it("dumps Serf script", function()
assert(prefix_handler.prepare_prefix(tmp_config))

Expand Down