Skip to content

Commit a98c8ee

Browse files
committed
Show if Sentry environment variable is configured in show_version
1 parent 5e297a6 commit a98c8ee

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

bin/run_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
from pycamp_bot.commands import schedule
1414
from pycamp_bot.commands import announcements
1515
from pycamp_bot.commands import devtools
16+
from pycamp_bot.constants import SENTRY_DATA_SOURCE_NAME_ENVVAR
1617
from pycamp_bot.models import models_db_connection
1718
from pycamp_bot.logger import logger
1819

1920

20-
SENTRY_DATA_SOURCE_NAME_ENVVAR = 'SENTRY_DATA_SOURCE_NAME'
2121
if SENTRY_DATA_SOURCE_NAME_ENVVAR in os.environ:
2222
sentry_sdk.init(dsn=os.environ[SENTRY_DATA_SOURCE_NAME_ENVVAR])
2323

src/pycamp_bot/commands/devtools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import os
12
import subprocess
23
import sys
34

45
from telegram.ext import CommandHandler
56

7+
from pycamp_bot.constants import SENTRY_DATA_SOURCE_NAME_ENVVAR
68
from pycamp_bot.utils import escape_markdown
79

810

@@ -28,6 +30,11 @@ async def show_version(update, context):
2830
for pip_line in pip_freeze.stdout.decode().splitlines():
2931
dependencies.append(escape_markdown(pip_line))
3032

33+
if SENTRY_DATA_SOURCE_NAME_ENVVAR in os.environ:
34+
sentry_envvar_set = '🟢'
35+
else:
36+
sentry_envvar_set = '🔴'
37+
3138
lines = [
3239
f'Commit deployado: `{commit}`',
3340
f'Fecha del commit \\(author date\\): `{escape_markdown(author_date)}`',
@@ -37,6 +44,7 @@ async def show_version(update, context):
3744
'```',
3845
*dependencies,
3946
'```',
47+
f'Variable de entorno de Sentry definida: {sentry_envvar_set}',
4048
]
4149

4250
await update.message.reply_text('\n'.join(lines), parse_mode='MarkdownV2')

src/pycamp_bot/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SENTRY_DATA_SOURCE_NAME_ENVVAR = 'SENTRY_DATA_SOURCE_NAME'

0 commit comments

Comments
 (0)