Coverage for gws-app/gws/base/web/manager.py: 91%
22 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-24 12:46 +0200
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-24 12:46 +0200
1from typing import Optional
3import gws
5from . import site
7class Config(gws.Config):
8 """Web server configuration"""
10 site: Optional[site.Config]
11 """Site configuration. (added in 8.4)"""
12 sites: Optional[list[site.Config]]
13 """Sites configuration. (deprecated in 8.4)"""
14 ssl: Optional[site.SSLConfig]
15 """SSL configuration."""
18class Object(gws.WebManager):
19 def configure(self):
20 p = self.cfg('site')
21 if not p:
22 # deprecated
23 cfgs = self.cfg('sites') or []
24 if len(cfgs) > 1:
25 raise gws.ConfigurationError('multiple web sites are not supported')
26 p = cfgs[0] if cfgs else gws.Config()
27 if self.cfg('ssl'):
28 p = gws.u.merge(p, ssl=True)
29 self.site = self.create_child(site.Object, p)
31 # deprecated
32 self.sites = [self.site]