Skip to content

Commit

Permalink
Add hostname to slack errors
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Sep 11, 2024
1 parent 7f77888 commit 3b1f20a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webapp/utils/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ def post(message):
key = os.environ.get("SLACK_API_KEY")
user_id = os.environ.get("SLACK_MENTION_USER_ID")
channel_id = os.environ.get("SLACK_CHANNEL_ID")
message = ""

if key is None:
return
if user_id:
message = f'<@{user_id}> {message}'
message += f'<@{user_id}>'

message += f' [hostname: {os.getenv('HOSTNAME')}]'
message += f' {message}'

requests.post(
SLACK_URL,
Expand Down

0 comments on commit 3b1f20a

Please sign in to comment.