1.2.5. configuration

This module provides the functionality to load the server’s configuration data.

1.2.5.1. Functions

ex_load_config(config_file, validate_schema=True)[source]

Load the server configuration from the specified file. This function is meant to be called early on during a scripts execution and if any error occurs, details will be printed and the process will exit.

Parameters
  • config_file (str) – The path to the configuration file to load.

  • validate_schema (bool) – Whether or not to validate the schema of the configuration.

Returns

The loaded server configuration.

Return type

Configuration

1.2.5.2. Classes

class Configuration(mem_object, prefix='')[source]

Bases: MemoryConfiguration

The server configuration object. This can load from files in both the JSON and YAML formats. Files in the YAML format can use the !include directive to include data from other files of supported formats.

classmethod from_file(file_path)[source]

Load the configuration from the specified file.

Parameters

file_path (str) – The path to the configuration file to load.

Returns

The loaded server configuration.

Return type

Configuration

iter_schema_errors(schema_file)[source]

Iterate over the ValidationError instances for all errors found within the specified schema.

Parameters

schema_file (str) – The path to the schema file to use for validation.

Returns

Each of the validation errors.

Return type

ValidationError

schema_errors(schema_file)[source]

Get a tuple of ValidationError instances for all errors found within the specified schema.

Parameters

schema_file (str) – The path to the schema file to use for validation.

Returns

The validation errors.

Return type

tuple