feat(sentry): remove Sentry #319
@@ -33,7 +33,6 @@ python-dotenv==1.0.1
 | 
				
			|||||||
PyYAML==6.0.2
 | 
					PyYAML==6.0.2
 | 
				
			||||||
requests==2.32.3
 | 
					requests==2.32.3
 | 
				
			||||||
requests-toolbelt==1.0.0
 | 
					requests-toolbelt==1.0.0
 | 
				
			||||||
sentry-sdk==2.19.0
 | 
					 | 
				
			||||||
six==1.16.0
 | 
					six==1.16.0
 | 
				
			||||||
toml==0.10.2
 | 
					toml==0.10.2
 | 
				
			||||||
tomli==2.1.0
 | 
					tomli==2.1.0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,4 @@ APPROVED_ROOMS="abc123,def456"
 | 
				
			|||||||
APPROVED_USERS="bob@example.com,john@me.com"
 | 
					APPROVED_USERS="bob@example.com,john@me.com"
 | 
				
			||||||
BOT_NAME=""
 | 
					BOT_NAME=""
 | 
				
			||||||
N8N_WEBHOOK_URL=""
 | 
					N8N_WEBHOOK_URL=""
 | 
				
			||||||
SENTRY_DSN=""
 | 
					 | 
				
			||||||
SENTRY_ENABLED="False"
 | 
					 | 
				
			||||||
WEBEX_API_KEY=""
 | 
					WEBEX_API_KEY=""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,14 +9,12 @@ Add tasks to a Wekan to do list via Webex and n8n.
 | 
				
			|||||||
3. Edit `.env` as required:
 | 
					3. Edit `.env` as required:
 | 
				
			||||||
    - `ADMIN_EMAIL` - comma-separated list of admin (who owns the to-do list) email addresses
 | 
					    - `ADMIN_EMAIL` - comma-separated list of admin (who owns the to-do list) email addresses
 | 
				
			||||||
    - `ADMIN_FIRST_NAME` - admin first name
 | 
					    - `ADMIN_FIRST_NAME` - admin first name
 | 
				
			||||||
    - `APP_LIFECYCLE` - for use in Sentry only, set the name of the environment
 | 
					    - `APP_LIFECYCLE` - set the name of the environment
 | 
				
			||||||
    - `APPROVED_DOMAINS` - comma-separated list of domains that users are allowed to message the bot from
 | 
					    - `APPROVED_DOMAINS` - comma-separated list of domains that users are allowed to message the bot from
 | 
				
			||||||
    - `APPROVED_ROOMS` - comma-separated list of room IDs that users are allowed to message the bot from
 | 
					    - `APPROVED_ROOMS` - comma-separated list of room IDs that users are allowed to message the bot from
 | 
				
			||||||
    - `APPROVED_USERS` - comma-separated list of email addresses of approved users
 | 
					    - `APPROVED_USERS` - comma-separated list of email addresses of approved users
 | 
				
			||||||
    - `BOT_NAME` - Webex bot name
 | 
					    - `BOT_NAME` - Webex bot name
 | 
				
			||||||
    - `N8N_WEBHOOK_URL` - n8n webhook URL
 | 
					    - `N8N_WEBHOOK_URL` - n8n webhook URL
 | 
				
			||||||
    - `SENTRY_DSN` - for use in Sentry only, set the DSN of the Sentry project
 | 
					 | 
				
			||||||
    - `SENTRY_ENABLED` - for use in Sentry only, enable sending data to Sentry
 | 
					 | 
				
			||||||
    - `WEBEX_API_KEY` - Webex API key
 | 
					    - `WEBEX_API_KEY` - Webex API key
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## How to use
 | 
					## How to use
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,9 +21,6 @@ from app.utils.n8n import get_tasks, submit_task
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
log: logging.Logger = logging.getLogger(__name__)
 | 
					log: logging.Logger = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if config.sentry_enabled:
 | 
					 | 
				
			||||||
    import sentry_sdk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SubmitTaskCommand(Command):
 | 
					class SubmitTaskCommand(Command):
 | 
				
			||||||
    """Submit task command."""
 | 
					    """Submit task command."""
 | 
				
			||||||
@@ -126,10 +123,7 @@ class SubmitTaskCommand(Command):
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        _result = response_from_adaptive_card(card)
 | 
					        _result = response_from_adaptive_card(card)
 | 
				
			||||||
        if not config.sentry_enabled:
 | 
					        return _result
 | 
				
			||||||
            return _result
 | 
					 | 
				
			||||||
        with sentry_sdk.start_transaction(name="submit_task_command"):
 | 
					 | 
				
			||||||
            return _result
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SubmitTaskCallback(Command):
 | 
					class SubmitTaskCallback(Command):
 | 
				
			||||||
@@ -173,10 +167,7 @@ class SubmitTaskCallback(Command):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def execute(self, message, attachment_actions, activity) -> str:
 | 
					    def execute(self, message, attachment_actions, activity) -> str:
 | 
				
			||||||
        """Execute method."""
 | 
					        """Execute method."""
 | 
				
			||||||
        if not config.sentry_enabled:
 | 
					        return self.msg
 | 
				
			||||||
            return self.msg
 | 
					 | 
				
			||||||
        with sentry_sdk.start_transaction(name="submit_task_callback"):
 | 
					 | 
				
			||||||
            return self.msg
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MyTasksCallback(Command):
 | 
					class MyTasksCallback(Command):
 | 
				
			||||||
@@ -193,21 +184,13 @@ class MyTasksCallback(Command):
 | 
				
			|||||||
    def pre_execute(self, message, attachment_actions, activity) -> str:
 | 
					    def pre_execute(self, message, attachment_actions, activity) -> str:
 | 
				
			||||||
        """Pre-execute method."""
 | 
					        """Pre-execute method."""
 | 
				
			||||||
        _msg: str = "Getting your tasks..."
 | 
					        _msg: str = "Getting your tasks..."
 | 
				
			||||||
        if not config.sentry_enabled:
 | 
					        return _msg
 | 
				
			||||||
            return _msg
 | 
					 | 
				
			||||||
        with sentry_sdk.start_transaction(name="my_tasks_preexec"):
 | 
					 | 
				
			||||||
            return _msg
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def execute(self, message, attachment_actions, activity) -> str | None:
 | 
					    def execute(self, message, attachment_actions, activity) -> str | None:
 | 
				
			||||||
        """Execute method."""
 | 
					        """Execute method."""
 | 
				
			||||||
        sender: str = attachment_actions.inputs.get("sender")
 | 
					        sender: str = attachment_actions.inputs.get("sender")
 | 
				
			||||||
        result: bool = get_tasks(requestor=sender)
 | 
					        result: bool = get_tasks(requestor=sender)
 | 
				
			||||||
        _msg: str = "Failed to get tasks. Please try again."
 | 
					        _msg: str = "Failed to get tasks. Please try again."
 | 
				
			||||||
        if not config.sentry_enabled:
 | 
					        if not result:
 | 
				
			||||||
            if not result:
 | 
					            return _msg
 | 
				
			||||||
                return _msg
 | 
					        return None
 | 
				
			||||||
            return None
 | 
					 | 
				
			||||||
        with sentry_sdk.start_transaction(name="my_tasks_exec"):
 | 
					 | 
				
			||||||
            if not result:
 | 
					 | 
				
			||||||
                return _msg
 | 
					 | 
				
			||||||
            return None
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								app/main.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								app/main.py
									
									
									
									
									
								
							@@ -2,25 +2,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from sentry_sdk.integrations.stdlib import StdlibIntegration
 | 
					 | 
				
			||||||
from webex_bot.webex_bot import WebexBot
 | 
					from webex_bot.webex_bot import WebexBot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from app.commands.exit import ExitCommand
 | 
					from app.commands.exit import ExitCommand
 | 
				
			||||||
from app.commands.submit_task import SubmitTaskCommand
 | 
					from app.commands.submit_task import SubmitTaskCommand
 | 
				
			||||||
from app.utils.config import config
 | 
					from app.utils.config import config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if config.sentry_enabled:
 | 
					 | 
				
			||||||
    import sentry_sdk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    apm = sentry_sdk.init(
 | 
					 | 
				
			||||||
        dsn=config.sentry_dsn,
 | 
					 | 
				
			||||||
        enable_tracing=True,
 | 
					 | 
				
			||||||
        environment=config.environment,
 | 
					 | 
				
			||||||
        release=config.version,
 | 
					 | 
				
			||||||
        integrations=[StdlibIntegration()],
 | 
					 | 
				
			||||||
        spotlight=True,
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def create_bot() -> WebexBot:
 | 
					def create_bot() -> WebexBot:
 | 
				
			||||||
    """Create and return a Webex Bot object."""
 | 
					    """Create and return a Webex Bot object."""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,15 +11,6 @@ class Config:
 | 
				
			|||||||
    def __init__(self) -> None:
 | 
					    def __init__(self) -> None:
 | 
				
			||||||
        """Configuration module."""
 | 
					        """Configuration module."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Sentry config needs to be processed first for loop prevention.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.__sentry_dsn: str = os.environ.get("SENTRY_DSN", "")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.__sentry_enabled: bool = bool(
 | 
					 | 
				
			||||||
            os.environ.get("SENTRY_ENABLED", "False").upper() == "TRUE"
 | 
					 | 
				
			||||||
            and self.__sentry_dsn != ""
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def environment(self) -> str:
 | 
					    def environment(self) -> str:
 | 
				
			||||||
        """Returns the current app lifecycle."""
 | 
					        """Returns the current app lifecycle."""
 | 
				
			||||||
@@ -30,19 +21,6 @@ class Config:
 | 
				
			|||||||
        """Returns the current app version."""
 | 
					        """Returns the current app version."""
 | 
				
			||||||
        return os.environ["APP_VERSION"]
 | 
					        return os.environ["APP_VERSION"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					 | 
				
			||||||
    def sentry_enabled(self) -> bool:
 | 
					 | 
				
			||||||
        """Returns True if Sentry SDK is enabled, else False."""
 | 
					 | 
				
			||||||
        return self.__sentry_enabled
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @property
 | 
					 | 
				
			||||||
    def sentry_dsn(self) -> str:
 | 
					 | 
				
			||||||
        """Returns the Sentry DSN value if Sentry SDK is enabled AND
 | 
					 | 
				
			||||||
        Sentry DSN is set, else blank string."""
 | 
					 | 
				
			||||||
        if not self.__sentry_enabled:
 | 
					 | 
				
			||||||
            return ""
 | 
					 | 
				
			||||||
        return self.__sentry_dsn
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def bot_name(self) -> str:
 | 
					    def bot_name(self) -> str:
 | 
				
			||||||
        """Returns the bot name."""
 | 
					        """Returns the bot name."""
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,9 +4,6 @@ import requests
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from app.utils.config import config
 | 
					from app.utils.config import config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if config.sentry_enabled:
 | 
					 | 
				
			||||||
    import sentry_sdk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def __n8n_post(data: dict) -> bool:
 | 
					def __n8n_post(data: dict) -> bool:
 | 
				
			||||||
    """Post data to N8N webhook URL.
 | 
					    """Post data to N8N webhook URL.
 | 
				
			||||||
@@ -46,12 +43,8 @@ def submit_task(summary, description, completion_date, requestor) -> bool:
 | 
				
			|||||||
        "description": description,
 | 
					        "description": description,
 | 
				
			||||||
        "completiondate": completion_date,
 | 
					        "completiondate": completion_date,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if not config.sentry_enabled:
 | 
					    _data = __n8n_post(data=data)
 | 
				
			||||||
        _data = __n8n_post(data=data)
 | 
					    return _data
 | 
				
			||||||
        return _data
 | 
					 | 
				
			||||||
    with sentry_sdk.start_transaction(name="submit_task"):
 | 
					 | 
				
			||||||
        _data = __n8n_post(data=data)
 | 
					 | 
				
			||||||
        return _data
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_tasks(requestor) -> bool:
 | 
					def get_tasks(requestor) -> bool:
 | 
				
			||||||
@@ -64,23 +57,12 @@ def get_tasks(requestor) -> bool:
 | 
				
			|||||||
        bool: True if successful, else False.
 | 
					        bool: True if successful, else False.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    headers: dict = {"Content-Type": "application/json"}
 | 
					    headers: dict = {"Content-Type": "application/json"}
 | 
				
			||||||
    if not config.sentry_enabled:
 | 
					    resp: requests.Response = requests.get(
 | 
				
			||||||
        resp: requests.Response = requests.get(
 | 
					        url=config.n8n_webhook_url,
 | 
				
			||||||
            url=config.n8n_webhook_url,
 | 
					        headers=headers,
 | 
				
			||||||
            headers=headers,
 | 
					        timeout=10,
 | 
				
			||||||
            timeout=10,
 | 
					        verify=False,
 | 
				
			||||||
            verify=False,
 | 
					        params={"requestor": requestor},
 | 
				
			||||||
            params={"requestor": requestor},
 | 
					    )
 | 
				
			||||||
        )
 | 
					    _data = bool(resp.status_code == 200)
 | 
				
			||||||
        _data = bool(resp.status_code == 200)
 | 
					    return _data
 | 
				
			||||||
        return _data
 | 
					 | 
				
			||||||
    with sentry_sdk.start_transaction(name="get_tasks"):
 | 
					 | 
				
			||||||
        resp: requests.Response = requests.get(
 | 
					 | 
				
			||||||
            url=config.n8n_webhook_url,
 | 
					 | 
				
			||||||
            headers=headers,
 | 
					 | 
				
			||||||
            timeout=10,
 | 
					 | 
				
			||||||
            verify=False,
 | 
					 | 
				
			||||||
            params={"requestor": requestor},
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        _data = bool(resp.status_code == 200)
 | 
					 | 
				
			||||||
        return _data
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										56
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										56
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							@@ -611,60 +611,6 @@ files = [
 | 
				
			|||||||
[package.dependencies]
 | 
					[package.dependencies]
 | 
				
			||||||
requests = ">=2.0.1,<3.0.0"
 | 
					requests = ">=2.0.1,<3.0.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "sentry-sdk"
 | 
					 | 
				
			||||||
version = "2.19.0"
 | 
					 | 
				
			||||||
description = "Python client for Sentry (https://sentry.io)"
 | 
					 | 
				
			||||||
optional = false
 | 
					 | 
				
			||||||
python-versions = ">=3.6"
 | 
					 | 
				
			||||||
files = [
 | 
					 | 
				
			||||||
    {file = "sentry_sdk-2.19.0-py2.py3-none-any.whl", hash = "sha256:7b0b3b709dee051337244a09a30dbf6e95afe0d34a1f8b430d45e0982a7c125b"},
 | 
					 | 
				
			||||||
    {file = "sentry_sdk-2.19.0.tar.gz", hash = "sha256:ee4a4d2ae8bfe3cac012dcf3e4607975904c137e1738116549fc3dbbb6ff0e36"},
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[package.dependencies]
 | 
					 | 
				
			||||||
certifi = "*"
 | 
					 | 
				
			||||||
urllib3 = ">=1.26.11"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[package.extras]
 | 
					 | 
				
			||||||
aiohttp = ["aiohttp (>=3.5)"]
 | 
					 | 
				
			||||||
anthropic = ["anthropic (>=0.16)"]
 | 
					 | 
				
			||||||
arq = ["arq (>=0.23)"]
 | 
					 | 
				
			||||||
asyncpg = ["asyncpg (>=0.23)"]
 | 
					 | 
				
			||||||
beam = ["apache-beam (>=2.12)"]
 | 
					 | 
				
			||||||
bottle = ["bottle (>=0.12.13)"]
 | 
					 | 
				
			||||||
celery = ["celery (>=3)"]
 | 
					 | 
				
			||||||
celery-redbeat = ["celery-redbeat (>=2)"]
 | 
					 | 
				
			||||||
chalice = ["chalice (>=1.16.0)"]
 | 
					 | 
				
			||||||
clickhouse-driver = ["clickhouse-driver (>=0.2.0)"]
 | 
					 | 
				
			||||||
django = ["django (>=1.8)"]
 | 
					 | 
				
			||||||
falcon = ["falcon (>=1.4)"]
 | 
					 | 
				
			||||||
fastapi = ["fastapi (>=0.79.0)"]
 | 
					 | 
				
			||||||
flask = ["blinker (>=1.1)", "flask (>=0.11)", "markupsafe"]
 | 
					 | 
				
			||||||
grpcio = ["grpcio (>=1.21.1)", "protobuf (>=3.8.0)"]
 | 
					 | 
				
			||||||
http2 = ["httpcore[http2] (==1.*)"]
 | 
					 | 
				
			||||||
httpx = ["httpx (>=0.16.0)"]
 | 
					 | 
				
			||||||
huey = ["huey (>=2)"]
 | 
					 | 
				
			||||||
huggingface-hub = ["huggingface_hub (>=0.22)"]
 | 
					 | 
				
			||||||
langchain = ["langchain (>=0.0.210)"]
 | 
					 | 
				
			||||||
launchdarkly = ["launchdarkly-server-sdk (>=9.8.0)"]
 | 
					 | 
				
			||||||
litestar = ["litestar (>=2.0.0)"]
 | 
					 | 
				
			||||||
loguru = ["loguru (>=0.5)"]
 | 
					 | 
				
			||||||
openai = ["openai (>=1.0.0)", "tiktoken (>=0.3.0)"]
 | 
					 | 
				
			||||||
openfeature = ["openfeature-sdk (>=0.7.1)"]
 | 
					 | 
				
			||||||
opentelemetry = ["opentelemetry-distro (>=0.35b0)"]
 | 
					 | 
				
			||||||
opentelemetry-experimental = ["opentelemetry-distro"]
 | 
					 | 
				
			||||||
pure-eval = ["asttokens", "executing", "pure_eval"]
 | 
					 | 
				
			||||||
pymongo = ["pymongo (>=3.1)"]
 | 
					 | 
				
			||||||
pyspark = ["pyspark (>=2.4.4)"]
 | 
					 | 
				
			||||||
quart = ["blinker (>=1.1)", "quart (>=0.16.1)"]
 | 
					 | 
				
			||||||
rq = ["rq (>=0.6)"]
 | 
					 | 
				
			||||||
sanic = ["sanic (>=0.8)"]
 | 
					 | 
				
			||||||
sqlalchemy = ["sqlalchemy (>=1.2)"]
 | 
					 | 
				
			||||||
starlette = ["starlette (>=0.19.1)"]
 | 
					 | 
				
			||||||
starlite = ["starlite (>=1.48)"]
 | 
					 | 
				
			||||||
tornado = ["tornado (>=6)"]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "setuptools"
 | 
					name = "setuptools"
 | 
				
			||||||
version = "75.6.0"
 | 
					version = "75.6.0"
 | 
				
			||||||
@@ -905,4 +851,4 @@ testing = ["coverage[toml]", "zope.event", "zope.testing"]
 | 
				
			|||||||
[metadata]
 | 
					[metadata]
 | 
				
			||||||
lock-version = "2.0"
 | 
					lock-version = "2.0"
 | 
				
			||||||
python-versions = "^3.11"
 | 
					python-versions = "^3.11"
 | 
				
			||||||
content-hash = "341e2cb729a0e9691470e528ed4b51908531612834963958eb5c88fb76939473"
 | 
					content-hash = "2b60fc563ffa2c3d82d6714b92627a110680b59194ddc33b2aee62f4cc576d55"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,6 @@ package-mode = false
 | 
				
			|||||||
[tool.poetry.dependencies]
 | 
					[tool.poetry.dependencies]
 | 
				
			||||||
python = "^3.11"
 | 
					python = "^3.11"
 | 
				
			||||||
webex-bot = "^0.5.2"
 | 
					webex-bot = "^0.5.2"
 | 
				
			||||||
sentry-sdk = "^2.19.0"
 | 
					 | 
				
			||||||
datetime = "^5.5"
 | 
					datetime = "^5.5"
 | 
				
			||||||
requests = "^2.32.3"
 | 
					requests = "^2.32.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								test.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								test.sh
									
									
									
									
									
								
							@@ -1,3 +1,3 @@
 | 
				
			|||||||
export $(cat .env.test | xargs)
 | 
					export $(cat .env.test | xargs)
 | 
				
			||||||
python -B -m app.main
 | 
					python -B -m app.main
 | 
				
			||||||
unset ADMIN_EMAIL ADMIN_FIRST_NAME APP_LIFECYCLE APP_VERSION APPROVED_DOMAINS APPROVED_ROOMS APPROVED_USERS BOT_NAME N8N_WEBHOOK_URL SENTRY_DSN SENTRY_ENABLED WEBEX_API_KEY
 | 
					unset ADMIN_EMAIL ADMIN_FIRST_NAME APP_LIFECYCLE APP_VERSION APPROVED_DOMAINS APPROVED_ROOMS APPROVED_USERS BOT_NAME N8N_WEBHOOK_URL WEBEX_API_KEY
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,8 +17,6 @@ def test_config() -> None:
 | 
				
			|||||||
        "ADMIN_FIRST_NAME": "Test",
 | 
					        "ADMIN_FIRST_NAME": "Test",
 | 
				
			||||||
        "ADMIN_EMAIL": "test@test.com",
 | 
					        "ADMIN_EMAIL": "test@test.com",
 | 
				
			||||||
        "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg",
 | 
					        "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg",
 | 
				
			||||||
        "SENTRY_ENABLED": "false",
 | 
					 | 
				
			||||||
        "SENTRY_DSN": "http://localhost",
 | 
					 | 
				
			||||||
        "APPROVED_USERS": "test@test.com",
 | 
					        "APPROVED_USERS": "test@test.com",
 | 
				
			||||||
        "APPROVED_DOMAINS": "test.com",
 | 
					        "APPROVED_DOMAINS": "test.com",
 | 
				
			||||||
        "APPROVED_ROOMS": "test",
 | 
					        "APPROVED_ROOMS": "test",
 | 
				
			||||||
@@ -37,16 +35,8 @@ def test_config() -> None:
 | 
				
			|||||||
    assert config.approved_users == config_vars["APPROVED_USERS"].split(",")
 | 
					    assert config.approved_users == config_vars["APPROVED_USERS"].split(",")
 | 
				
			||||||
    assert config.bot_name == config_vars["BOT_NAME"]
 | 
					    assert config.bot_name == config_vars["BOT_NAME"]
 | 
				
			||||||
    assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"]
 | 
					    assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"]
 | 
				
			||||||
    assert config.sentry_enabled == bool(
 | 
					 | 
				
			||||||
        config_vars["SENTRY_ENABLED"].upper() == "TRUE"
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    assert config.version == config_vars["APP_VERSION"]
 | 
					    assert config.version == config_vars["APP_VERSION"]
 | 
				
			||||||
    assert config.webex_token == config_vars["WEBEX_API_KEY"]
 | 
					    assert config.webex_token == config_vars["WEBEX_API_KEY"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if config.sentry_enabled:
 | 
					 | 
				
			||||||
        assert config.sentry_dsn == config_vars["SENTRY_DSN"]
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
        assert config.sentry_dsn == ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for config_var in config_vars:
 | 
					    for config_var in config_vars:
 | 
				
			||||||
        os.environ.pop(config_var, None)
 | 
					        os.environ.pop(config_var, None)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,8 +17,6 @@ def test_config_no_admin_vars() -> None:
 | 
				
			|||||||
        "ADMIN_FIRST_NAME": "Test",
 | 
					        "ADMIN_FIRST_NAME": "Test",
 | 
				
			||||||
        "ADMIN_EMAIL": "test@test.com",
 | 
					        "ADMIN_EMAIL": "test@test.com",
 | 
				
			||||||
        "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg",
 | 
					        "N8N_WEBHOOK_URL": "https://n8n.test.com/webhook/abcdefg",
 | 
				
			||||||
        "SENTRY_ENABLED": "false",
 | 
					 | 
				
			||||||
        "SENTRY_DSN": "http://localhost",
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for config_var, value in config_vars.items():
 | 
					    for config_var, value in config_vars.items():
 | 
				
			||||||
@@ -34,16 +32,8 @@ def test_config_no_admin_vars() -> None:
 | 
				
			|||||||
    assert config.admin_first_name == config_vars["ADMIN_FIRST_NAME"]
 | 
					    assert config.admin_first_name == config_vars["ADMIN_FIRST_NAME"]
 | 
				
			||||||
    assert config.bot_name == config_vars["BOT_NAME"]
 | 
					    assert config.bot_name == config_vars["BOT_NAME"]
 | 
				
			||||||
    assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"]
 | 
					    assert config.n8n_webhook_url == config_vars["N8N_WEBHOOK_URL"]
 | 
				
			||||||
    assert config.sentry_enabled == bool(
 | 
					 | 
				
			||||||
        config_vars["SENTRY_ENABLED"].upper() == "TRUE"
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    assert config.version == config_vars["APP_VERSION"]
 | 
					    assert config.version == config_vars["APP_VERSION"]
 | 
				
			||||||
    assert config.webex_token == config_vars["WEBEX_API_KEY"]
 | 
					    assert config.webex_token == config_vars["WEBEX_API_KEY"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if config.sentry_enabled:
 | 
					 | 
				
			||||||
        assert config.sentry_dsn == config_vars["SENTRY_DSN"]
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
        assert config.sentry_dsn == ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for config_var in config_vars:
 | 
					    for config_var in config_vars:
 | 
				
			||||||
        os.environ.pop(config_var, None)
 | 
					        os.environ.pop(config_var, None)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user