Skip to content

gufo.thor.config

Config data structures.

CliConfig dataclass

Bases: object

Config populated during runtime.

Should not be set by user. Populated from CLI options.

Config dataclass

Bases: object

The Gufo Thor config.

Attributes:

Name Type Description
project Optional[str]

Optional project name used to prefix the services and volumes. If not set - directory name is used. Should be unique within Thor projects on same host.

noc NocConfig

The noc section of the config.

expose ExposeConfig

The expose section of the config.

services Dict[str, ServiceConfig]

The services section of the config.

default() staticmethod

Generate default config.

Returns:

Type Description
Config

An Config instance

from_yaml(data) staticmethod

Parse YAML file and return an instance of the Config.

Parameters:

Name Type Description Default
data str

String containing YAML config.

required

Returns:

Type Description
Config

An Config instance.

ExposeConfig dataclass

Bases: object

The expose section of the config.

Attributes:

Name Type Description
domain_name str

A domain name through which the NOC's user interface will be accessed in browser.

port int

An HTTPS port of the NOC's user interface.

from_dict(data) staticmethod

Generate ExposeConfig instance from a dictionary.

Args: data: Incoming data.

Returns: A configured ExposeConfig instance.

NocConfig dataclass

Bases: object

The noc section of the config.

Attributes:

Name Type Description
tag str

NOC image tag

path Optional[str]

An optional path to the NOC source code. If not empty, image's /opt/nocvwill be replaced with path

custom Optional[str]

Optional path to the custom, will be mounted in the /opt/noc_custom directory.

installation_name str

The installation name which will be shown in the interface.

theme Literal['noc', 'gray']

Web interface theme. One of: noc, gray.

migrate bool

Run migrations on start

from_dict(data) staticmethod

Generate NocConfig instance from a dictionary.

Parameters:

Name Type Description Default
data Dict[str, Any]

Incoming data.

required

Returns:

Type Description
NocConfig

A configured NocConfig instance.

ServiceConfig dataclass

Bases: object

The services section of the config.

Attributes:

Name Type Description
tag Optional[str]

Override noc.tag setting for a service if not empty.

scale int

Number of concurrently running servers. 0 - disable.

default() staticmethod

Get default ServiceConfig.

from_dict(data) staticmethod

Generate ServiceConfig instance from a dictionary.

Parameters:

Name Type Description Default
data Dict[str, Any]

Incoming data.

required

Returns:

Type Description
ServiceConfig

A configured ServiceConfig instance.

get_sample(name)

Get preconfigured config sample by name.

All samples are preserved in samples directory.

Parameters:

Name Type Description Default
name str

Sample name, without .yml extension.

required

Returns:

Type Description
str

A string containinng sample code.