Coverage for gws-app/gws/server/core.py: 100%
58 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Configuration for embedded servers."""
3from typing import Optional, Literal
5import gws
8class SpoolConfig(gws.Config):
9 """Spool server, which runs background jobs."""
11 enabled: Optional[bool]
12 """The module is enabled. (deprecated in 8.2)"""
13 workers: int = 4
14 """Number of spool worker processes."""
15 jobFrequency: gws.Duration = '3'
16 """Interval at which the spool server checks for new jobs."""
17 timeout: gws.Duration = '300'
18 """Max. run time of a background job before it is aborted."""
21class WebConfig(gws.Config):
22 """Web server, which handles client and API requests."""
24 enabled: Optional[bool]
25 """The module is enabled. (deprecated in 8.2)"""
26 workers: int = 4
27 """Number of web worker processes."""
28 maxRequestLength: int = 10
29 """Max. request body size in megabytes."""
30 timeout: gws.Duration = '60'
31 """Max. time to process a request before it is aborted."""
34class MonitorConfig(gws.Config):
35 """Monitor, which watches files and runs periodic tasks."""
37 enabled: Optional[bool]
38 """The module is enabled. (deprecated in 8.2)"""
39 frequency: gws.Duration = '30'
40 """Default interval of periodic tasks."""
41 disableWatch: bool = False
42 """Do not reconfigure the server when watched files change."""
43 ignore: Optional[list[gws.Regex]]
44 """Ignore paths that match these regexes. (deprecated in 8.2)"""
47class QgisConfig(gws.Config):
48 """External QGIS server configuration."""
50 host: str = 'qgis'
51 """Host where the QGIS server runs."""
52 port: int = 80
53 """Port of the QGIS server."""
56class LogConfig(gws.Config):
57 """Logging configuration."""
59 path: str = ''
60 """Log path."""
61 level: str = 'INFO'
62 """Log level."""
65class Config(gws.Config):
66 """Server processes and logging."""
68 mapproxy: Optional[dict]
69 """Bundled MapProxy module, ignored. (deprecated in 8.5)"""
70 monitor: Optional[MonitorConfig]
71 """Monitor configuration."""
72 log: Optional[LogConfig]
73 """Logging configuration."""
74 qgis: Optional[QgisConfig]
75 """QGIS server configuration."""
76 spool: Optional[SpoolConfig]
77 """Spool server module configuration."""
78 web: Optional[WebConfig]
79 """Web server module configuration."""
81 withWeb: bool = True
82 """Run the web server."""
83 withSpool: bool = True
84 """Run the spool server for background jobs."""
85 withMapproxy: Optional[bool]
86 """Run the MapProxy server, ignored. (deprecated in 8.5)"""
87 withMonitor: bool = True
88 """Run the monitor."""
90 templates: Optional[list[gws.ext.config.template]]
91 """Templates for the nginx, uWSGI and syslog configs and the start script."""
93 autoRun: str = ''
94 """Shell command to run before the server start. (deprecated in 8.2)"""
95 preConfigure: str = ''
96 """Shell or Python script to run before configuring the server."""
97 postConfigure: str = ''
98 """Shell or Python script to run after the server has been configured."""
99 timeZone: str = 'Europe/Berlin'
100 """Time zone of the server."""