Skip to content

Commit

Permalink
Add environment variable for slack webhook failures_only (#48)
Browse files Browse the repository at this point in the history
Add SENSORSAFRICA_CELERY_SLACK_WEBHOOK_FAILURES_ONLY environment variable for slack webhook failures_only option
  • Loading branch information
kilemensi authored Sep 10, 2019
1 parent ae7e3b6 commit 255b49d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sensorsafrica/celeryapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@
# Autodiscover tasks in tasks.py
app.autodiscover_tasks()

slack_app = Slackify(app, os.environ.get("SENSORSAFRICA_CELERY_SLACK_WEBHOOK", ""))
SLACK_WEBHOOK = os.environ.get("SENSORSAFRICA_CELERY_SLACK_WEBHOOK", "")
SLACK_WEBHOOK_FAILURES_ONLY = os.environ.get(
"SENSORSAFRICA_CELERY_SLACK_WEBHOOK_FAILURES_ONLY", "").strip().lower() in ('true', 't', '1')

options = {'failures_only': SLACK_WEBHOOK_FAILURES_ONLY}

slack_app = Slackify(app, SLACK_WEBHOOK, **options)

0 comments on commit 255b49d

Please sign in to comment.