diff options
-rw-r--r-- | bot/__init__.py | 7 | ||||
-rw-r--r-- | bot/constants.py | 2 | ||||
-rw-r--r-- | bot/log.py | 6 |
3 files changed, 5 insertions, 10 deletions
diff --git a/bot/__init__.py b/bot/__init__.py index 67165073..6646f2af 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -1,10 +1,3 @@ -try: - from dotenv import load_dotenv - print("Found .env file, loading environment variables from it.") # noqa: T201 - load_dotenv(override=True) -except ModuleNotFoundError: - pass - import asyncio import os from typing import TYPE_CHECKING diff --git a/bot/constants.py b/bot/constants.py index 894ea857..0d74fb4a 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -33,6 +33,7 @@ log = get_logger(__name__) PYTHON_PREFIX = "!" +GIT_SHA = environ.get("GIT_SHA", "development") class EnvConfig( @@ -90,6 +91,7 @@ class _Client(EnvConfig, env_prefix="client_"): github_repo: str = "https://github.com/python-discord/sir-lancebot" # Override seasonal locks: 1 (January) to 12 (December) month_override: int | None = None + sentry_dsn: str = "" Client = _Client() @@ -10,7 +10,7 @@ from pydis_core.utils import logging as core_logging from sentry_sdk.integrations.logging import LoggingIntegration from sentry_sdk.integrations.redis import RedisIntegration -from bot.constants import Logging +from bot.constants import Client, GIT_SHA, Logging def setup() -> None: @@ -59,12 +59,12 @@ def setup_sentry() -> None: ) sentry_sdk.init( - dsn=os.environ.get("BOT_SENTRY_DSN"), + dsn=Client.sentry_dsn, integrations=[ sentry_logging, RedisIntegration(), ], - release=f"bot@{os.environ.get('GIT_SHA')}", + release=f"bot@{GIT_SHA}", traces_sample_rate=0.5, _experiments={ "profiles_sample_rate": 0.5, |