-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(declarative-config): set hash when config is loaded #9911
Conversation
kong/db/declarative/init.lua
Outdated
@@ -660,6 +660,11 @@ end | |||
declarative.unique_field_key = unique_field_key | |||
|
|||
|
|||
local function config_is_empty(entities) | |||
-- empty configuration has no entries other than workspaces | |||
return entities["workspaces"] and tablex.size(entities) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use https://github.com/openresty/luajit2#tablenkeys for tablex.size
. Might be faster for large configs.
Also, do we need to do and entities.workspace
just to be safe? I'm not sure if it is possible to have an entities
that has not workspace or will it always be added by the parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use https://github.com/openresty/luajit2#tablenkeys for tablex.size. Might be faster for large configs.
Done, thanks!
do we need to do and entities.workspace just to be safe?
Do you mean the entities["workspaces"]
check in my return statement above? That should be always populated here:
kong/kong/db/declarative/init.lua
Line 254 in 2b8d444
self.schema:insert_default_workspace_if_not_given(entities) |
Due to #9890, we should rebase this PR. |
Ensure the configuration hash field is correctly configured when the declarative configuration is loaded on startup.
ensure the default (empty) config returns the appropriate hash that identifies the empty configuration: 00000000000000000000000000000000
thank you @chronolaw, done. |
… parameters (#9911) After the query parameters of the graphql are parsed into AST, there are three types: listType, nonNullType, and namedType. Are their structures different, so the way of obtaining variable types from the structure is also different. This PR is compatible with different structures for obtaining variable types. Fix FTI-6153
Ensure the
hash
field is correctly configured when the declarative configuration is loaded.