uhhh lots of things
All checks were successful
Datadog Software Composition Analysis / Datadog SBOM Generation and Upload (push) Successful in 16s
Datadog Secrets Scanning / Datadog Static Analyzer (push) Successful in 14s
Datadog Static Analysis / Datadog Static Analyzer (push) Successful in 24s

This commit is contained in:
2025-03-08 11:17:24 -05:00
parent 0a6d5b8a90
commit c6f36d0408
7 changed files with 222 additions and 44 deletions

View File

@ -9,10 +9,19 @@ class Configuration:
def __init__(self, config_path):
self.config_path = config_path
self.content_dir: Path = None
self.templates_dir: Path = None
self.styles_dir: Path = None
self.listen_address: str = "127.0.0.1"
self.listen_port: int = 8080
self.debug: bool = False
self.access_log: bool = True
self.max_threads: int = 4
self.admin_browser: bool = False
self.admin_password: str = None
def load_config(self):
try:
with open(self.config_path, "rb") as f:
@ -40,6 +49,18 @@ class Configuration:
if not self.styles_dir:
raise ValueError("Config file does not contain styles_dir path")
self.styles_dir = Path(self.styles_dir)
server = self.config_data.get("server", {})
if not server:
raise ValueError("Config file does not contain server section")
self.listen_address = server.get("listen_address", self.listen_address)
self.listen_port = server.get("listen_port", self.listen_port)
self.debug = server.get("debug", self.debug)
self.access_log = server.get("access_log", self.access_log)
self.max_threads = server.get("max_threads", self.max_threads)
self.admin_browser = server.get("admin_browser", self.admin_browser)
self.admin_password = server.get("admin_password", self.admin_password)
def set_globals(self):
global CONTENT_DIR, TEMPLATES_DIR, STYLES_DIR