Config: Migrate to global class instead of dicts

The config categories can have defined separation, but preserve
the dynamic nature of adding new config options by making all the
internal class vars as dictionaries.

This was necessary since storing global callbacks stored a state
of the previous global_config var that wasn't populated.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2024-09-04 23:13:36 -04:00
parent e772fa2981
commit 93872b34d7
10 changed files with 149 additions and 153 deletions

View File

@@ -10,7 +10,7 @@ from pydantic import BaseModel
from typing import Optional
from uuid import uuid4
from common import config
from common.tabby_config import config
from common.utils import unwrap
@@ -39,7 +39,7 @@ def handle_request_error(message: str, exc_info: bool = True):
"""Log a request error to the console."""
trace = traceback.format_exc()
send_trace = unwrap(config.network_config().get("send_tracebacks"), False)
send_trace = unwrap(config.network.get("send_tracebacks"), False)
error_message = TabbyRequestErrorMessage(
message=message, trace=trace if send_trace else None
@@ -134,7 +134,7 @@ def get_global_depends():
depends = [Depends(add_request_id)]
if config.logging_config().get("requests"):
if config.logging.get("requests"):
depends.append(Depends(log_request))
return depends