-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Related to #328 : pgagroal-cli
should provide a capability to set some run-time configuration parameters while the system is running.
I imagine a command line like the following one:
pgagroal-cli config-set log_level debug
The workflow should be pretty much the following one:
- communicate via socket the name of the parameter to set and its value
- if the parameter has a good value, set it
- report back over the socket the current parameter value
In the case the parameter cannot be changed on the fly, at step 2, then step 3 will report back the current setting, otherwise the new setting.
I see the need for refactoring of the function pgagroal_read_configuration
https://github.com/agroal/pgagroal/blob/master/src/libpgagroal/configuration.c#L169 because this time the configuration does not arrive from a file, rather from a single setting, so the bits that parse a single argument (e.g., https://github.com/agroal/pgagroal/blob/master/src/libpgagroal/configuration.c#L363) should be indepdentt and shared among a file based configuration and a dynamic one.
Moreover, not all parameters can be changed at runtime without a restart. My proposal is to use a similar approach at that of a reload
action:
- clone the current configuration
- apply the new setting;
- issue a
pgagroal_transfer_configuration
(after validation steps).
This means that also pgagrla_reload
function https://github.com/agroal/pgagroal/blob/master/src/libpgagroal/configuration.c#L1814 requires refactoring to handle not only a reload driven by a file, but also driven by a single change in the parameters.