feat: remote client deel 1
This commit is contained in:
@@ -9,6 +9,10 @@ from pathlib import Path
|
||||
class Settings:
|
||||
root_aliases: dict[str, str]
|
||||
task_db_path: str
|
||||
remote_client_registration_token: str
|
||||
remote_client_offline_timeout_seconds: int
|
||||
remote_client_agent_auth_header: str
|
||||
remote_client_agent_auth_scheme: str
|
||||
|
||||
|
||||
DEFAULT_ROOT_ALIASES = {
|
||||
@@ -40,4 +44,17 @@ def get_settings() -> Settings:
|
||||
task_db_path = os.getenv("WEBMANAGER_TASK_DB_PATH", default_task_db_path).strip()
|
||||
if not task_db_path:
|
||||
task_db_path = default_task_db_path
|
||||
return Settings(root_aliases=_load_root_aliases(), task_db_path=task_db_path)
|
||||
raw_offline_timeout = os.getenv("WEBMANAGER_REMOTE_CLIENT_OFFLINE_TIMEOUT_SECONDS", "60").strip()
|
||||
try:
|
||||
remote_client_offline_timeout_seconds = max(1, int(raw_offline_timeout))
|
||||
except ValueError:
|
||||
remote_client_offline_timeout_seconds = 60
|
||||
return Settings(
|
||||
root_aliases=_load_root_aliases(),
|
||||
task_db_path=task_db_path,
|
||||
remote_client_registration_token=os.getenv("WEBMANAGER_REMOTE_CLIENT_REGISTRATION_TOKEN", "").strip(),
|
||||
remote_client_offline_timeout_seconds=remote_client_offline_timeout_seconds,
|
||||
remote_client_agent_auth_header=os.getenv("WEBMANAGER_REMOTE_CLIENT_AGENT_AUTH_HEADER", "Authorization").strip()
|
||||
or "Authorization",
|
||||
remote_client_agent_auth_scheme=os.getenv("WEBMANAGER_REMOTE_CLIENT_AGENT_AUTH_SCHEME", "Bearer").strip() or "Bearer",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user