Skip to content

Commit

Permalink
move apicast policy to be in correct folder with others
Browse files Browse the repository at this point in the history
this is going to be a breaking change for policies that previously
required apicast policy
  • Loading branch information
mikz committed Nov 21, 2017
1 parent ac16fe2 commit 4df243b
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/configuration/echo.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"host": "echo"
},
"policy_chain": [
{ "name": "policy.echo" },
{ "name": "apicast" }
{ "name": "apicast.policy.echo" },
{ "name": "apicast.policy.apicast" }
],
"proxy_rules": [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-module/blacklist.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local apicast = require('apicast').new()
local apicast = require('apicast.policy.apicast').new()
local iputils = require("resty.iputils")
local default_balancer = require('apicast.balancer').default_balancer
local resty_balancer = require('resty.balancer')
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/apicast/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local prequire = function(file)
return ok, ret
end

local name = env.get('APICAST_MODULE') or 'apicast'
local name = env.get('APICAST_MODULE') or 'apicast.policy.apicast'

local ok, mod = prequire(name)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gateway/src/apicast/policy/local_chain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local function build_default_chain()
-- Needed to keep compatibility with the old module system.
module = 'apicast.module'
else
module = 'apicast'
module = 'apicast.policy.apicast'
end

return require('apicast.policy_chain').build({ module })
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/apicast/policy_chain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ local mt = {
-- @treturn PolicyChain New PolicyChain
function _M.build(modules)
local chain = {}
local list = modules or { 'apicast' }
local list = modules or { 'apicast.policy.apicast' }

for i=1, #list do
chain[i] = _M.load(list[i])
Expand Down
2 changes: 1 addition & 1 deletion spec/examples/custom-module/blacklist_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local _M = require 'examples.custom-module.blacklist'
local apicast = require 'apicast'
local apicast = require 'apicast.policy.apicast'

describe('blacklist', function()
it('returns new module instance', function()
Expand Down
2 changes: 1 addition & 1 deletion spec/module_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('module', function()
end)

it('defaults to apicast', function()
local apicast = require('apicast')
local apicast = require('apicast.policy.apicast')
local module = require('apicast.module')

assert.truthy(module._NAME)
Expand Down
2 changes: 1 addition & 1 deletion spec/apicast_spec.lua → spec/policy/apicast_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local _M = require 'apicast'
local _M = require 'apicast.policy.apicast'

describe('APIcast module', function()

Expand Down
2 changes: 1 addition & 1 deletion spec/policy_chain_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('policy_chain', function()
end)

it('uses APIcast as default when no policies are specified', function()
local apicast = require 'apicast'
local apicast = require 'apicast.policy.apicast'
local policy_chain = require 'apicast.policy_chain'

-- Stub apicast methods to avoid calling them. We are just interested in
Expand Down
2 changes: 1 addition & 1 deletion spec/user_agent_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('User Agent', function()

describe('.platform', function()
it('includes os information', function()
local apicast = require('apicast')
local apicast = require('apicast.policy.apicast')

assert.same('APIcast/' .. apicast._VERSION, user_agent.platform())
end)
Expand Down
2 changes: 1 addition & 1 deletion t/apicast-policy-chains.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ defined at the service level.
backend_authentication_type = 'service_token',
backend_authentication_value = 'token-value',
proxy = {
policy_chain = { { name = 'apicast.policy.phase_logger' }, { name = 'apicast' } },
policy_chain = { { name = 'apicast.policy.phase_logger' }, { name = 'apicast.policy.apicast' } },
api_backend = "http://127.0.0.1:$TEST_NGINX_SERVER_PORT/api-backend/",
proxy_rules = {
{
Expand Down

0 comments on commit 4df243b

Please sign in to comment.