config: remove web settings as they are now in web frontend.
This commit is contained in:
parent
b88aed3731
commit
4fda71eeec
2 changed files with 15 additions and 18 deletions
|
|
@ -71,6 +71,10 @@ except:
|
||||||
"pip install jinja2"
|
"pip install jinja2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from libervia.web.common.settings import WebSettings
|
||||||
|
except ImportError:
|
||||||
|
WebSettings = None
|
||||||
|
|
||||||
HTML_EXT = ("html", "xhtml")
|
HTML_EXT = ("html", "xhtml")
|
||||||
RE_ATTR_ESCAPE = re.compile(r"[^a-z_-]")
|
RE_ATTR_ESCAPE = re.compile(r"[^a-z_-]")
|
||||||
|
|
@ -398,12 +402,17 @@ class Renderer:
|
||||||
"": os.path.dirname(sat_templates.__file__),
|
"": os.path.dirname(sat_templates.__file__),
|
||||||
}
|
}
|
||||||
self.sites_themes = {}
|
self.sites_themes = {}
|
||||||
conf = config.parse_main_conf()
|
if WebSettings is None:
|
||||||
public_sites = conf.web.sites_path_public_dict
|
log.warning("WebSettings not available, is Libervia.web installed?")
|
||||||
sites_data = [public_sites]
|
sites_data = []
|
||||||
if private:
|
else:
|
||||||
private_sites = conf.web.sites_path_private_dict
|
conf = config.parse_main_conf(ignore_cache=True)
|
||||||
sites_data.append(private_sites)
|
web_conf = conf.get_settings(WebSettings)
|
||||||
|
public_sites = web_conf.sites_path_public
|
||||||
|
sites_data = [public_sites]
|
||||||
|
if private:
|
||||||
|
private_sites = web_conf.sites_path_private
|
||||||
|
sites_data.append(private_sites)
|
||||||
for sites in sites_data:
|
for sites in sites_data:
|
||||||
normalised = {}
|
normalised = {}
|
||||||
for name, path in sites.items():
|
for name, path in sites.items():
|
||||||
|
|
|
||||||
|
|
@ -192,17 +192,6 @@ BridgeSettings = Annotated[
|
||||||
B = TypeVar("B", bound=BridgeSettings)
|
B = TypeVar("B", bound=BridgeSettings)
|
||||||
|
|
||||||
|
|
||||||
class WebSettings(ConfigOptions):
|
|
||||||
# FIXME: to be moved to web frontend.
|
|
||||||
model_config = ConfigDict(extra="allow")
|
|
||||||
sites_path_public: dict[str, str] = Field(
|
|
||||||
default_factory=dict, description="Dictionary of public site paths"
|
|
||||||
)
|
|
||||||
sites_path_private_dict: dict[str, str] = Field(
|
|
||||||
default_factory=dict, description="Dictionary of private site paths"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class EmailSettings(ConfigOptions):
|
class EmailSettings(ConfigOptions):
|
||||||
|
|
||||||
server: str = Field(default="localhost", description="Email server address")
|
server: str = Field(default="localhost", description="Email server address")
|
||||||
|
|
@ -399,7 +388,6 @@ class Settings(BaseSettings):
|
||||||
email: EmailSettings = Field(default_factory=EmailSettings)
|
email: EmailSettings = Field(default_factory=EmailSettings)
|
||||||
tls: TLSSettings = Field(default_factory=TLSSettings)
|
tls: TLSSettings = Field(default_factory=TLSSettings)
|
||||||
tor: TorSettings = Field(default_factory=TorSettings)
|
tor: TorSettings = Field(default_factory=TorSettings)
|
||||||
web: WebSettings = Field(default_factory=WebSettings)
|
|
||||||
plugins: dict = Field(default_factory=dict, description="Plugin specific settings.")
|
plugins: dict = Field(default_factory=dict, description="Plugin specific settings.")
|
||||||
components: dict = Field(
|
components: dict = Field(
|
||||||
default_factory=dict, description="Component specific settings."
|
default_factory=dict, description="Component specific settings."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue