utils.readconfig¶
This is the function which reads/parses the config file which contains all necessary parameters such as database configuration.
Todo
The config.conf.template
and the utils.readconfig()
method
contain some settings and code lines which were only used to migrate the data
from the old Wetterturnier system into the new version. Should be cleaned
somewhen in the near future.
Note
Function for reading/parsing the config file. This method is used
in all The Scripts within the Wetterturnier backend script library.
This repository contains a config.conf.template
template which can be used to produce a custom config.conf
file which is,
by default, used by the utils.readconfig()
method.
More details on how to setup the local config.conf
file can be found on the
Getting Started page in section
Setting up the config.conf file.
Documentation for this module. More details should be added.
-
utils.
readconfig
(file='config.conf', inputs=None, conversion_table=None)[source]¶ Reading config file. There is a ‘global’ wetterturnier backend config file which is necessary to handle all the actions. This method also checks some parameters. E.g., if a required directory or file does not exist, the script stops.
Parameters: - file (
str
) – string File name of the config file. Default isconfig.conf
. - inputs (
dict
) – Usually the input dict fromutils.inputcheck()
. Default is None. If it is a dict: all parameters will be added to the config dict which will be generated in this method. In case a key exists in the config dict (created in here) and is duplicated in the inputs dict the script will stop immediately.
Returns: A dict containing all necessary configs.
Return type: dict
- file (