Skip to content

Commit

Permalink
Merge pull request 3scale#432 from 3scale/3.1-stable-fix-oidc-loading
Browse files Browse the repository at this point in the history
[THREESCALE-360] fix loading configuration with null values
  • Loading branch information
mikz authored Sep 26, 2017
2 parents 780658d + 0d00ea9 commit e01a8a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apicast/src/configuration_store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function _M.store(self, config, ttl)
local hosts = service.hosts or {}
local id = service.id

if oidc[i] then
if oidc[i] ~= ngx.null then
-- merge service and OIDC config, this is far from ideal, but easy for now
for k,v in pairs(oidc[i] or {}) do
service.oidc[k] = v
Expand Down
8 changes: 8 additions & 0 deletions spec/configuration_store_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ describe('Configuration Store', function()

assert.equal(service, store:find_by_id('42'))
end)

it('stores config with OIDC', function()
local store = configuration.new()
local service_one = { id = '7', hosts = { 'example.com' } }
local service_two = { id = '42', hosts = { 'oidc.example.com' } }

assert(store:store({services = { service_one, service_two }, oidc = { ngx.null, ngx.null }}))
end)
end)

describe('.find_by_id', function()
Expand Down

0 comments on commit e01a8a2

Please sign in to comment.