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"
|
||||
)
|
||||
|
||||
try:
|
||||
from libervia.web.common.settings import WebSettings
|
||||
except ImportError:
|
||||
WebSettings = None
|
||||
|
||||
HTML_EXT = ("html", "xhtml")
|
||||
RE_ATTR_ESCAPE = re.compile(r"[^a-z_-]")
|
||||
|
|
@ -398,12 +402,17 @@ class Renderer:
|
|||
"": os.path.dirname(sat_templates.__file__),
|
||||
}
|
||||
self.sites_themes = {}
|
||||
conf = config.parse_main_conf()
|
||||
public_sites = conf.web.sites_path_public_dict
|
||||
sites_data = [public_sites]
|
||||
if private:
|
||||
private_sites = conf.web.sites_path_private_dict
|
||||
sites_data.append(private_sites)
|
||||
if WebSettings is None:
|
||||
log.warning("WebSettings not available, is Libervia.web installed?")
|
||||
sites_data = []
|
||||
else:
|
||||
conf = config.parse_main_conf(ignore_cache=True)
|
||||
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:
|
||||
normalised = {}
|
||||
for name, path in sites.items():
|
||||
|
|
|
|||
|
|
@ -192,17 +192,6 @@ BridgeSettings = Annotated[
|
|||
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):
|
||||
|
||||
server: str = Field(default="localhost", description="Email server address")
|
||||
|
|
@ -399,7 +388,6 @@ class Settings(BaseSettings):
|
|||
email: EmailSettings = Field(default_factory=EmailSettings)
|
||||
tls: TLSSettings = Field(default_factory=TLSSettings)
|
||||
tor: TorSettings = Field(default_factory=TorSettings)
|
||||
web: WebSettings = Field(default_factory=WebSettings)
|
||||
plugins: dict = Field(default_factory=dict, description="Plugin specific settings.")
|
||||
components: dict = Field(
|
||||
default_factory=dict, description="Component specific settings."
|
||||
|
|
|
|||
Loading…
Reference in a new issue