fix: move hardcoded Discord webhook URL to environment variable
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m42s

Replace inline webhook URL+token with DISCORD_WEBHOOK_URL env var.
Logs a warning and returns False gracefully if the var is unset.

The exposed webhook token should be rotated in Discord.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-26 23:15:21 -05:00
parent da679b6d1a
commit 3be4f71e22

View File

@ -503,6 +503,9 @@ def update_season_pitching_stats(player_ids, season, db_connection):
raise
DISCORD_WEBHOOK_URL = os.environ.get("DISCORD_WEBHOOK_URL")
def send_webhook_message(message: str) -> bool:
"""
Send a message to Discord via webhook.
@ -513,7 +516,12 @@ def send_webhook_message(message: str) -> bool:
Returns:
bool: True if successful, False otherwise
"""
webhook_url = "https://discord.com/api/webhooks/1408811717424840876/7RXG_D5IqovA3Jwa9YOobUjVcVMuLc6cQyezABcWuXaHo5Fvz1en10M7J43o3OJ3bzGW"
webhook_url = DISCORD_WEBHOOK_URL
if not webhook_url:
logger.warning(
"DISCORD_WEBHOOK_URL env var is not set — skipping webhook message"
)
return False
try:
payload = {"content": message}