-
Notifications
You must be signed in to change notification settings - Fork 33
feat(POC): add run time config management service #2355
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
feat(POC): add run time config management service #2355
Conversation
e8b20cd to
26bb728
Compare
…inals for sync change logging
6a92f73 to
e7e05c5
Compare
|
@Junjiequan Can you add an example for how to use this? |
bpedersen2
left a comment
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.
Sound good in general.
I guess a filter for certain fields will be needed in the end if we allow be-config changes, e.g. to avoid loss of all admin groups or changes to mongodb settings( I would probably keep all security-related fields as file-only).
Frontend-config should be less critical.
sbliven
left a comment
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.
I think we should discuss the core premise of this POC, which is that the configuration should be stored in the database instead of in files. While it would be convenient to be able to change the configuration on the fly, I'm worried that it will become even harder to track configuration changes. If we do it, I think there should be a clear process to "burn in" the configuration: export non-default settings to an env file, empty the database, and restart the backend with a clean configuration. Otherwise it's hard to keep track of changes.
Can you add a description of the usage to the README or docs? Even if it changes later, it would be helpful to read how the merging works. I think you said that the database is considered canon and overrides anything in the config files or the defaults.
How does this fit with /admin/config? Would this provide the merged "frontend" data?
Likewise, will calls to the configService be merged to the "backend" data? If so, we should double-check that there aren't any remaining direct calls to configuration(), as those would bypass the configService.
I guess you would add more endpoints
- get the full, merged configuration
- get/set individual properties (or would this just be done with PATCH application/json+merge?)
- way to delete configuration changes (resetting from the files or defaults)
We defintelly needs to discuss more about this, I just wanted to pull the idea into code, so we can have something to disccuss upon. If i understand your proposal correctly, you are suggesting that:
So, the config file is the source of truth, config record is temporary copy for real time editing. once the backend restarts the temporary state resets and rebuilt from the file again. Is it correct intepretation?
Sure, I will provide it as soon as possible.
It's up for discussion that wheter if we still want to keep /admin/config after we have the runtimeConfig endpoint.
The backend data ( environment variables I assume ) is completly seperated logic and should not be relevant to the run time config service at all, they are out of scope this time at least. The run time service serves for frontend related configs only.
I imagine the entry sturcture will look like this: [
{
"_id": "frontendConfig",
"description": "Some text to be rendered on the UI",
"data": {
"...": "raw JSON blob"
}
},
{
"_id": "frontendTheme",
"data": {
"...": "raw JSON blob"
}
},
{
"_id": "someOtherConfig",
"data": {
"...": "raw JSON blob"
}
}
]On the frontend we use |
|
@sbliven valid feedback!!! |
…fig-into-the-data
nitrosx
left a comment
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.
Minor changes to the swagger controller tags.
Food for thoughts: we should add authorization to the get configuration endpoint, so admins can restrict access to some entries. The authorization is not for the endpoint is for each individual entry.
...but this is for the future
|
@sbliven All the previous comments have been addressed. if there's no more comments, I'm planning to merge the PR in this week as this PR has been stalled for quite long time. |
…fig-into-the-data
Description
This PR introduces a runtime configuration system.
Introduced runtime-config module:
Added new API endpoints:
Supported configuration IDs:
CONFIG_SYNC_TO_DB_LIST ENVvariableOn application startup:
📌📌 Config files are always the source of truth 📌📌
Minor admin/config endpoint workflow changes:
admin/confignow internally callruntime-config/frontendConfigadmin/themenow internally callruntime-config/frontendThemeBoth endpoints still exist.
Only the internal flow changed, with no breaking API changes.
Motivation
This feature adds a DB-backed config store so the frontend config can be edited at runtime without rebuilding. The backend still treats the JSON files as the source of truth and auto-loads them into the Storage collection on startup (POC scope is only frontend config, even though the backend can load any config file). This makes it easier to test UI changes, share configs across environments, and edit them easily through JSONForms.
Fixes
Changes:
Tests included
Documentation
official documentation info