Skip to content

Set runtime configuration via pgagroal-cli #329

@fluca1978

Description

@fluca1978

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:

  1. communicate via socket the name of the parameter to set and its value
  2. if the parameter has a good value, set it
  3. 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:

  1. clone the current configuration
  2. apply the new setting;
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions