chore(sentry): remove Sentry
This commit is contained in:
parent
c04d23f85d
commit
9ea669f0fa
@ -1,4 +1,2 @@
|
|||||||
APP_LIFECYCLE="dev"
|
APP_LIFECYCLE="dev"
|
||||||
SENTRY_ENABLED="False"
|
|
||||||
SENTRY_DSN=""
|
|
||||||
WEBEX_API_KEY=""
|
WEBEX_API_KEY=""
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -133,3 +133,6 @@ dmypy.json
|
|||||||
# IDE
|
# IDE
|
||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
# Ruff
|
||||||
|
.ruff_cache/
|
||||||
|
@ -11,11 +11,6 @@ class Config:
|
|||||||
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()
|
self.__environment: str = os.environ.get("APP_LIFECYCLE", "DEV").upper()
|
||||||
self.__version: str = os.environ["APP_VERSION"]
|
self.__version: str = os.environ["APP_VERSION"]
|
||||||
self.__webex_token: str = os.environ["WEBEX_API_KEY"]
|
self.__webex_token: str = os.environ["WEBEX_API_KEY"]
|
||||||
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:
|
||||||
@ -27,19 +22,6 @@ class Config:
|
|||||||
"""Returns the current app version."""
|
"""Returns the current app version."""
|
||||||
return self.__version
|
return self.__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 webex_token(self) -> str:
|
def webex_token(self) -> str:
|
||||||
"""Returns the Webex API key."""
|
"""Returns the Webex API key."""
|
||||||
|
@ -18,7 +18,7 @@ CHAR_REPLACEMENTS: list = [
|
|||||||
|
|
||||||
def get_templates() -> list[dict]:
|
def get_templates() -> list[dict]:
|
||||||
url: str = "https://api.memegen.link/templates"
|
url: str = "https://api.memegen.link/templates"
|
||||||
req: requests.Response = requests.get(url=url, timeout=5)
|
req: requests.Response = requests.get(url=url, timeout=10)
|
||||||
req.raise_for_status()
|
req.raise_for_status()
|
||||||
data: dict = req.json()
|
data: dict = req.json()
|
||||||
templates: list = []
|
templates: list = []
|
||||||
|
12
app/main.py
12
app/main.py
@ -1,22 +1,10 @@
|
|||||||
#!/usr/local/bin/python3
|
#!/usr/local/bin/python3
|
||||||
|
|
||||||
import sentry_sdk
|
|
||||||
from sentry_sdk.integrations.stdlib import StdlibIntegration
|
|
||||||
from webex_bot.webex_bot import WebexBot
|
from webex_bot.webex_bot import WebexBot
|
||||||
|
|
||||||
from app import close, meme
|
from app import close, meme
|
||||||
from app.config import config
|
from app.config import config
|
||||||
|
|
||||||
if config.sentry_enabled:
|
|
||||||
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 a Bot object."""
|
"""Create a Bot object."""
|
||||||
|
@ -5,8 +5,6 @@ import os
|
|||||||
vars: dict = {
|
vars: dict = {
|
||||||
"APP_VERSION": "dev",
|
"APP_VERSION": "dev",
|
||||||
"WEBEX_API_KEY": "testing",
|
"WEBEX_API_KEY": "testing",
|
||||||
"SENTRY_ENABLED": "false",
|
|
||||||
"SENTRY_DSN": "http://localhost",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -20,4 +18,3 @@ from app.config import config # pragma: no cover # noqa: E402
|
|||||||
def test_config() -> None:
|
def test_config() -> None:
|
||||||
assert config.webex_token == vars["WEBEX_API_KEY"]
|
assert config.webex_token == vars["WEBEX_API_KEY"]
|
||||||
assert config.version == vars["APP_VERSION"]
|
assert config.version == vars["APP_VERSION"]
|
||||||
assert config.sentry_enabled == bool(vars["SENTRY_ENABLED"].lower() == "true")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user