genvid.toolbox.ConfigTool¶
-
class
genvid.toolbox.
ConfigTool
(**kwargs)¶ Bases:
genvid.toolbox.consul.ConsulTool
Manage genvid configuration
-
add_config_commands
()¶ Add the config commands to the parser.
Run it from
add_commands()
to add the jobs commands to the parser.
-
clear_config
(key='')¶ Delete the selected configuration and its children.
-
get_config
(key)¶ Get configuration value.
-
get_config_as_dict
(key)¶ Get configuration value as a dictionary.
-
get_loggers
()¶ Get the list of loggers and their level
-
load_config
(*paths)¶ Load configuration from file.
-
merge_config
(*paths: typing.List[str]) → dict¶ Merge configuration from file.
-
run_config_command
(command, options)¶ Detect if the command is a config command and execute it.
Call it from
run_command()
to handle config commands. All-in-one commands are added with the help ofadd_config_commands()
.- Returns:
- handled, result: A tuple with a boolean saying if the command were handled, and it’s result if that the case.
-
set_config
(cfg: dict)¶ Set configuration.
Transform recursively the dictionnary cfg in a list of key-value pairs to insert into Consul.
-
set_config_value
(key, value)¶ Set configuration value.
-
set_log_level
(logger, level)¶ Set the service logger verbosity
-
show_config
(key='')¶ Print configuration from key in JSON format.
-
show_loggers
()¶ Print the list of loggers
-