Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#328] Introduce subcommand
config-get
.
This commit introduces the `pgagroal-cli` subcommand `config-get` that allows the user to query the running `pgagroal` instance and obtain the value of a configuration parameter. A new management action, named ACTION_CONFIG_GET, is added to manage the communication over the socket between `pgagroal-cli` and the main `pgagroal` process. A few utility functions to handle the communication have been introduced to send data over the socket and receive it on the socket. Moreover, different utility functions to print out the value of a configuration setting have been introduced, so that for instance all the boolean values are always mapped to "on" and "off". The `pgagroal-cli config-get` command accepts a key to search. Usually the key is searched into the global configuration namespace, that is the section `[pgagroal]`. However, it is possible to define other keys that can be handled: - `server.<server-name>.<what>` will search 'what' within the server section named `[server-name]`, as an example `server.venkman.host`; - `limit.<database>.<what>` will search 'what' within the pgagroal_databases.conf file entries (runtime) for the specified database name; - `hba.<user>.<what>` will search 'what' among the runtime HBA configuration for the user 'user'. Note that in the case of 'hba.' and 'limit.', since the username or database name can appear multiple times, only the first occurency is matched. The match happens in a simple way, so for instance the database name 'foo' does not match an entry with 'all'. It is also possible to specify a key starting with `pgagroal.`, that will instrument the search within the global namespace. Therefore `max_entries` and `pgagroal.max_entries` are the same search terms. If a key is not found, the main `pgagroal` process issue a warning in the logs, while the application `pgagroal-cli` does receive an empty answer and therefore does nothing. Even in the case of a non-existing key, `pgagroal-cli` exists normally, to indicate that the query has been performed well, simply with no meaningful answer. If `pgagroal-cli` is running with `--verbose` flag, the application prints the configuration entry with the key and the value, like in pgagroal-cli get-config max_entries max_entries = 300 this is useful for humans, but not for automated systems, so the default way of answering a query is by printing only the value pgagroal-cli get-config max_entries 300 Documentation updated. Shell completions updated. Close #328
- Loading branch information
1 parent
4278118
commit 07b79cc
Showing
9 changed files
with
1,124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.