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 |
expose |
ExposeConfig
|
The |
services |
Dict[str, ServiceConfig]
|
The |
default()
staticmethod
¶
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. |
web |
Optional[Listen]
|
Web listener configuration. |
port |
Optional[Listen]
|
An HTTPS port of the NOC's user interface (deprecated). |
open_browser |
bool
|
Open browser on startup. |
from_dict(data)
staticmethod
¶
Generate ExposeConfig instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
ExposeConfig
|
A configured ExposeConfig instance. |
Listen
dataclass
¶
Bases: object
Listener configuration.
Used to proxy host's ports into the container.
Accepts formats:
* <port>
* "<port>"
* "<address>:<port>"
* {"port": <port>}
* {"address": "<address>", "port": <port>}
Attributes:
Name | Type | Description |
---|---|---|
address |
str
|
Listen address. |
port |
int
|
Listen port. |
docker_compose_port(container_port)
¶
Generate configuration for port forwarding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container_port
|
int
|
Port in the container. |
required |
Returns:
Type | Description |
---|---|
str
|
Port configuration for docker compose. |
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 |
custom |
Optional[str]
|
Optional path to the custom, will be mounted
in the |
installation_name |
str
|
The installation name which will be shown in the interface. |
theme |
Literal['noc', 'gray']
|
Web interface theme. One of: |
migrate |
bool
|
Run migrations on start |
config |
Optional[Dict[str, Any]]
|
User-defined config. |
ServiceConfig
dataclass
¶
Bases: object
The services
section of the config.
Attributes:
Name | Type | Description |
---|---|---|
tag |
Optional[str]
|
Override |
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 |
required |
Returns:
Type | Description |
---|---|
str
|
A string containinng sample code. |