Reading in configuration


flexmeasures.utils.config_utils.are_required_settings_complete(app) bool

Check if all settings we expect are not None. Return False if they are not. Printout helpful advice.

flexmeasures.utils.config_utils.check_app_env(env: str | None)

Configure and register logging

flexmeasures.utils.config_utils.get_config_warnings(app) tuple[list[str], list[str]]

return missing settings and the warnings for them.

flexmeasures.utils.config_utils.get_configuration_keys(app) list[str]

Collect all members of DefaultConfig who are not in-built fields or callables.

flexmeasures.utils.config_utils.read_config(app: Flask, custom_path_to_config: str | None)

Read configuration from various expected sources, complain if not setup correctly.

flexmeasures.utils.config_utils.read_custom_config(app: Flask, suggested_path_to_config, path_to_config_home, path_to_config_instance) str

Read in a custom config file and env vars. For the config, there are two fallback options, tried in a specific order: If no custom path is suggested, we’ll try the path in the home dir first, then in the instance dir.

Return the path to the config file.

flexmeasures.utils.config_utils.read_env_vars(app: Flask)

Read in what we support as environment settings. At the moment, these are: - All required and warnable variables - Logging settings - access tokens - plugins (handled in plugin utils)