Classes in this module manage system configuration.
Each Reahl component can have its own config file. The config files of all components used by an application are stored in a common directory. If the config file for a component is missing, defaults are assumed.
Config files are Python code. Inside a config file, an instance of the component’s Configuration is bound to a variable name.
- class reahl.component.config.StoredConfiguration(config_directory_name, strict_checking=False)¶
The Configuration of a whole set of components, stored together in a directory.
Read and optionally validate the configuration.
validate – If True (the default), also check that all required config is specified and warns about dangerous defaults.
- class reahl.component.config.Configuration¶
A collection of ConfigSettings for a component. To supply configuration for your component, subclass from this class and assign each wanted ConfigSetting as a class attribute. Assign the required filename and config_key class attributes in your subclass as well. The resultant class should also be listed in the .reahlproject file of your component in a <configuration> element.
- filename = None¶
The name of the config file from which this Configuration will be read.
- config_key = None¶
The variable name to which an instance of this Configuration will be bound when reading filename
- class reahl.component.config.ConfigSetting(default=<class 'reahl.component.config.ExplicitSettingRequired'>, description='No description supplied', dangerous=False, automatic=False)¶
Used to define one configuration setting on a
default – The default value to be used if not specified in a config file.
description – A user readable description explaining what this ConfigSetting is for.
dangerous – Set this to True, if a warning should be emitted when used with the supplied default value.
automatic – Set this to True for a ConfigSetting which is meant to be used for dependency injection.
- class reahl.component.config.DeferredDefault(getter)¶
DeferredDefault wraps a callable, which will be called only once the config value is read. The callable is passed a single argument: the Configuration on which this ConfigSetting is defined.
- class reahl.component.config.EntryPointClassList(name, description='Description not supplied')¶
ConfigSettingwhich is not set by a user at all – rather, its value (a list of classes or other importable Python objects) is read from the entry point named name.
name – The name of the entry point to read.
description – (See