pgagroal: getting run-time configuration

pgagroal, the fast connection pooler for PostgreSQL, is gaining new features! In this commit I introduced a new command for pgagroal-cli: config-get. Such command allows the user to specify the name of a configuration parameter and get back the value the pooler is using. As an example:

% pgagroal-cli get-config max_connections
300

% pgagroal-cli get-config max_connections --verbose
max_connections = 300


When the command is invoked with the --verbose flag, the application respond with a full configuration line that can then be copied and pasted into a new configuration file.

INI sections

The config-get command allows also for the specification of sections, for example if you pgagroal.conf configuration file is like the following:

% cat pgagroal.conf
[pgagroal]
...

[venkman]
host = 192.168.2.2
port = 5432
primary = off



it is possible to query the command with the section name, and the application will dig into the INI file section:

% pgagroal-cli config-get venkman.host
192.168.2.2



Thanks to this, it is possible to get all the main configuration out of pgagroal-cli.

Limit and HBA entries

Similarly to the sections, the config-get command allows the specification of parameters to search for a limit entry or an HBA entry. In such case, the key to search for is the username to match for an HBA entry and the database to match for a limit entry. The special key prefix limit or hba allows the command to understand where to dig. As an example:

% pgagroal-cli config-get limit.testdb.max_size
10

% pgagroal-cli config-get hba.luca.method
md5



See the pgagroal-cli documentation for more examples and details.



```

The article pgagroal: getting run-time configuration has been posted by Luca Ferrari on November 30, 2022