-
Notifications
You must be signed in to change notification settings - Fork 386
Description
Is your feature request related to a problem? Please describe.
It should be nice to have a settings section for the core plugin where we can specify the custom variables used for the cat. When opening the settings, the default values will be set as the corresponding ENV variable.
Example:
variable name: log_level
default value: get_env('LOG_LEVEL') or 'INFO'
get_env
Line 38 in f14f2c0
| def get_env(name): |
default_value of log_level:
Line 12 in f14f2c0
| "CCAT_LOG_LEVEL": "INFO", |
With this change, we can add additional settings without the need to introduce additional ENV variables.
This can avoid any breaking changes for all deployments already in production but let us define additional settings even without introducing other ENVs
some use cases:
- in adding session manager #943 we can define the expiration timeout
- in lowering recall threshold #912 we can add three different recall thresholds
Describe the solution you'd like
A user can override those settings runtime. When the user saves the settings, those values are written inside the cat data folder, maybe in a new settings.json file.
On startup, the code checks for the existence of settings.json. If no file is present it will be filled with the default values and then saved.
For newer values without an ENV, we can modify the settings.json default template to include that default values
We can then use the watch library to listen for changes to that file, and then restart the server if needed
Describe alternatives you've considered
Change settings without the watch library involved. In this case, the server must be restarted manually to apply the new values