1.2.4. build

This module contains the functionality to build a new server instance from a configuration file. This intends to keep the error checking logic for potential configuration problems contained.

1.2.4.1. Functions

get_bind_addresses(config)[source]

Retrieve the addresses on which the server should bind to. Each of these addresses should be an IP address, port and optionally enable SSL. The returned list will contain tuples for each address found in the configuration. These tuples will be in the (host, port, use_ssl) format that is compatible with AdvancedHTTPServer.

Parameters

config (smoke_zephyr.configuration.Configuration) – Configuration to retrieve settings from.

Returns

The specified addresses to bind to.

Return type

list

get_ssl_hostnames(config)[source]

Retrieve the SSL hosts that are specified within the configuration. This also ensures that the settings appear to be valid by ensuring that the necessary files are defined and readable.

Parameters

config (smoke_zephyr.configuration.Configuration) – Configuration to retrieve settings from.

Returns

The specified SSH hosts.

Return type

list

server_from_config(config, handler_klass=None, plugin_manager=None)[source]

Build a server from a provided configuration instance. If handler_klass is specified, then the object must inherit from the corresponding KingPhisherServer base class.

Parameters
  • config (smoke_zephyr.configuration.Configuration) – Configuration to retrieve settings from.

  • handler_klass (KingPhisherRequestHandler) – Alternative handler class to use.

  • plugin_manager (ServerPluginManager) – The server’s plugin manager instance.

Returns

A configured server instance.

Return type

KingPhisherServer