mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-07 18:01:10 +00:00
added debug_mode to the system settings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
"""Charting settings."""
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@@ -9,11 +10,14 @@ from openbb_core.env import Env
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class ChartingSettings:
|
||||
"""Charting settings."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
user_settings: Optional[UserSettings] = None,
|
||||
system_settings: Optional[SystemSettings] = None,
|
||||
):
|
||||
"""Initialize charting settings."""
|
||||
user_settings = user_settings or UserSettings()
|
||||
system_settings = system_settings or SystemSettings()
|
||||
|
||||
@@ -29,7 +33,7 @@ class ChartingSettings:
|
||||
self.python_version: str = system_settings.python_version
|
||||
self.test_mode = system_settings.test_mode
|
||||
self.app_id: str = get_app_id(user_data_directory)
|
||||
self.debug_mode: bool = Env().DEBUG_MODE
|
||||
self.debug_mode: bool = system_settings.debug_mode or Env().DEBUG_MODE
|
||||
self.headless: bool = system_settings.headless
|
||||
# User
|
||||
self.plot_enable_pywry: bool = user_settings.preferences.plot_enable_pywry
|
||||
|
||||
@@ -47,6 +47,7 @@ class SystemSettings(Tagged):
|
||||
api_settings: FastAPISettings = Field(default_factory=FastAPISettings)
|
||||
|
||||
# Others
|
||||
debug_mode: bool = False
|
||||
test_mode: bool = False
|
||||
headless: bool = False
|
||||
|
||||
@@ -86,7 +87,7 @@ class SystemSettings(Tagged):
|
||||
def validate_posthog_handler(cls, values: "SystemSettings") -> "SystemSettings":
|
||||
"""If the user has enabled log collection, then we need to add the Posthog."""
|
||||
if (
|
||||
not any([values.test_mode, values.logging_suppress])
|
||||
not any([values.test_mode, values.debug_mode, values.logging_suppress])
|
||||
and values.log_collect
|
||||
and "posthog" not in values.logging_handlers
|
||||
):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
"""System service."""
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -18,11 +19,10 @@ class SystemService(metaclass=SingletonMeta):
|
||||
"headless",
|
||||
"logging_sub_app",
|
||||
"api_settings",
|
||||
"debug_mode",
|
||||
}
|
||||
|
||||
PRO_VALIDATION_HASH = (
|
||||
"300ac59fdcc8f899e0bc5c18cda8652220735da1a00e2af365efe9d8e5fe8306"
|
||||
)
|
||||
PRO_VALIDATION_HASH = "300ac59fdcc8f899e0bc5c18cda8652220735da1a00e2af365efe9d8e5fe8306" # pragma: allowlist secret
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user