Skip to content

Commit

Permalink
dont return the default value from select_by_name for dbless mode (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
chobits authored Oct 11, 2024
1 parent e446748 commit ccf122a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kong/db/dao/workspaces.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ local constants = require("kong.constants")
local lmdb = require("resty.lmdb")


local DECLARATIVE_DEFAULT_WORKSPACE_ID = constants.DECLARATIVE_DEFAULT_WORKSPACE_ID
local DECLARATIVE_DEFAULT_WORKSPACE_KEY = constants.DECLARATIVE_DEFAULT_WORKSPACE_KEY


Expand All @@ -28,8 +27,12 @@ end

function Workspaces:select_by_name(key, options)
if kong.configuration.database == "off" and key == "default" then
-- We can ensure that when starting in dbless mode, lmdb will by default
-- insert a 'default' workspace. If this Kong is a dataplane, it will later
-- synchronize the configuration from the CP and overwrite this default one.
--
-- it should be a table, not a single string
return { id = lmdb.get(DECLARATIVE_DEFAULT_WORKSPACE_KEY) or DECLARATIVE_DEFAULT_WORKSPACE_ID, }
return { id = lmdb.get(DECLARATIVE_DEFAULT_WORKSPACE_KEY), }
end

return self.super.select_by_name(self, key, options)
Expand Down

0 comments on commit ccf122a

Please sign in to comment.