Browse Source

Fix, settings and views.py

pull/471/head
msansen1 4 years ago
parent
commit
12f61099cd
2 changed files with 21 additions and 32 deletions
  1. +11
    -12
      hc/front/views.py
  2. +10
    -20
      hc/settings.py

+ 11
- 12
hc/front/views.py View File

@ -749,42 +749,41 @@ def channels(request, code):
channels = Channel.objects.filter(project=project)
channels = channels.order_by("created")
channels = channels.annotate(n_checks=Count("checks"))
ctx = {
"page": "channels",
"rw": rw,
"project": project,
"profile": project.owner_profile,
"channels": channels,
"enable_email": settings.EMAIL_ENABLED is True,
"enable_apprise": settings.APPRISE_ENABLED is True,
"enable_call": settings.TWILIO_AUTH is not None,
"enable_discord": settings.DISCORD_CLIENT_ID is not None,
"enable_linenotify": settings.LINENOTIFY_CLIENT_ID is not None,
"enable_matrix": settings.MATRIX_ACCESS_TOKEN is not None,
"enable_mattermost": settings.MATTERMOST_ENABLED is True,
"enable_msteams": settings.MSTEAMS_ENABLED is True,
"enable_pagerduty": settings.PAGERDUTY_ENABLED is True,
"enable_pdc": settings.PD_VENDOR_KEY is not None,
"enable_prometheus": settings.PROMETHEUS_ENABLED is True,
"enable_pushbullet": settings.PUSHBULLET_CLIENT_ID is not None,
"enable_pushover": settings.PUSHOVER_API_TOKEN is not None,
"enable_spike": settings.SPIKE_ENABLED is True,
"enable_shell": settings.SHELL_ENABLED is True,
"enable_slack": settings.SLACK_ENABLED is True,
"enable_signal": settings.SIGNAL_CLI_ENABLED is True,
"enable_slack_btn": settings.SLACK_CLIENT_ID is not None,
"enable_sms": settings.SMS_ENABLED is True,
"enable_telegram": settings.TELEGRAM_ENABLED is True,
"enable_trello": settings.TRELLO_ENABLED is True,
"enable_sms": settings.TWILIO_AUTH is not None,
"enable_telegram": settings.TELEGRAM_TOKEN is not None,
"enable_trello": settings.TRELLO_APP_KEY is not None,
"enable_whatsapp": settings.TWILIO_USE_WHATSAPP,
"enable_mattermost": settings.MATTERMOST_ENABLED is True,
"enable_msteams": settings.MSTEAMS_ENABLED is True,
"enable_prometheus": settings.PROMETHEUS_ENABLED is True,
"enable_spike": settings.SPIKE_ENABLED is True,
"enable_zulip": settings.ZULIP_ENABLED is True,
"enable_opsgenie": settings.OPSGENIE_ENABLED is True,
"enable_victorops": settings.VICTOROPS_ENABLED is True,
"enable_webhook": settings.WEBHOOK_ENABLED is True,
"enable_whatsapp": settings.TWILIO_USE_WHATSAPP,
"use_payments": settings.USE_PAYMENTS,
}
return render(request, "front/channels.html", ctx)


+ 10
- 20
hc/settings.py View File

@ -26,7 +26,7 @@ def envint(s, default):
return int(v)
SECRET_KEY = os.getenv("SECRET_KEY", "")
SECRET_KEY = os.getenv("SECRET_KEY", "---")
METRICS_KEY = os.getenv("METRICS_KEY")
DEBUG = envbool("DEBUG", "True")
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "*").split(",")
@ -172,8 +172,9 @@ COMPRESS_CSS_HASHING_METHOD = "content"
# WebAuthn
RP_ID = os.getenv("RP_ID")
#Integrations are enabled is settings are not empty
# Discord integration
DISCORD_ENABLED = envbool("DISCORD_ENABLED", "True")
DISCORD_CLIENT_ID = os.getenv("DISCORD_CLIENT_ID")
DISCORD_CLIENT_SECRET = os.getenv("DISCORD_CLIENT_SECRET")
@ -187,25 +188,21 @@ EMAIL_USE_TLS = envbool("EMAIL_USE_TLS", "True")
EMAIL_USE_VERIFICATION = envbool("EMAIL_USE_VERIFICATION", "True")
# Slack integration
SLACK_ENABLED = envbool("SLACK_ENABLED", "True")
SLACK_CLIENT_ID = os.getenv("SLACK_CLIENT_ID")
SLACK_CLIENT_SECRET = os.getenv("SLACK_CLIENT_SECRET")
# Pushover integration
PUSHOVER_ENABLED = envbool("PUSHOVER_ENABLED", "True")
PUSHOVER_API_TOKEN = os.getenv("PUSHOVER_API_TOKEN")
PUSHOVER_SUBSCRIPTION_URL = os.getenv("PUSHOVER_SUBSCRIPTION_URL")
PUSHOVER_EMERGENCY_RETRY_DELAY = int(os.getenv("PUSHOVER_EMERGENCY_RETRY_DELAY", "300"))
PUSHOVER_EMERGENCY_EXPIRATION = int(os.getenv("PUSHOVER_EMERGENCY_EXPIRATION", "86400"))
# Pushbullet integration
PUSHBULLET_ENABLED = envbool("PUSHBULLET_ENABLED", "True")
PUSHBULLET_CLIENT_ID = os.getenv("PUSHBULLET_CLIENT_ID")
PUSHBULLET_CLIENT_SECRET = os.getenv("PUSHBULLET_CLIENT_SECRET")
# Telegram integration -- override in local_settings.py
TELEGRAM_ENABLED = envbool("TELEGRAM_ENABLED", "True")
TELEGRAM_BOT_NAME = os.getenv("TELEGRAM_BOT_NAME", "ExampleBot")
TELEGRAM_BOT_NAME = os.getenv("TELEGRAM_BOT_NAME")
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN")
# SMS and WhatsApp (Twilio) integration
@ -219,11 +216,9 @@ PAGERDUTY_ENABLED = envbool("PAGERDUTY_ENABLED", "True")
PD_VENDOR_KEY = os.getenv("PD_VENDOR_KEY")
# Trello
TRELLO_ENABLED = envbool("TRELLO_ENABLED", "True")
TRELLO_APP_KEY = os.getenv("TRELLO_APP_KEY")
# Matrix
MATRIX_ENABLED = envbool("MATRIX_ENABLED", "True")
MATRIX_HOMESERVER = os.getenv("MATRIX_HOMESERVER")
MATRIX_USER_ID = os.getenv("MATRIX_USER_ID")
MATRIX_ACCESS_TOKEN = os.getenv("MATRIX_ACCESS_TOKEN")
@ -235,21 +230,16 @@ APPRISE_ENABLED = envbool("APPRISE_ENABLED", "False")
SHELL_ENABLED = envbool("SHELL_ENABLED", "False")
#Intégration Feature Toggle
MATTERMOST_ENABLED = envbool("MATTERMOST_ENABLED", "True")
OPSGENIE_ENABLED = envbool("OPSGENIE_ENABLED", "True")
PAGERTREE_ENABLED = envbool("PAGERTREE_ENABLED", "True")
PROMETHEUS_ENABLED = envbool("PROMETHEUS_ENABLED", "True")
VICTOROPS_ENABLED = envbool("VICTOROPS_ENABLED", "True")
SMS_ENABLED = envbool("SMS_ENABLED", "True")
CALL_ENABLED = envbool("CALL_ENABLED", "True")
MATTERMOST_ENABLED = envbool("MATTERMOST_ENABLED", "False")
OPSGENIE_ENABLED = envbool("OPSGENIE_ENABLED", "False")
VICTOROPS_ENABLED = envbool("VICTOROPS_ENABLED", "False")
WEBHOOK_ENABLED = envbool("WEBHOOK_ENABLED", "True")
WHATSAPP_ENABLED = envbool("WHATSAPP_ENABLED", "True")
MSTEAMS_ENABLED = envbool("MSTEAMS_ENABLED", "True")
ZULIP_ENABLED = envbool("ZULIP_ENABLED", "True")
SPIKE_ENABLED = envbool("SPIKE_ENABLED", "True")
ZULIP_ENABLED = envbool("ZULIP_ENABLED", "False")
SPIKE_ENABLED = envbool("SPIKE_ENABLED", "False")
PROMETHEUS_ENABLED = envbool("PROMETHEUS_ENABLED", "False")
# LINE Notify
LINENOTIFY_ENABLED = envbool("LINENOTIFY_ENABLED", "True")
LINENOTIFY_CLIENT_ID = os.getenv("LINENOTIFY_CLIENT_ID")
LINENOTIFY_CLIENT_SECRET = os.getenv("LINENOTIFY_CLIENT_SECRET")


Loading…
Cancel
Save