diff --git a/website/spotify/apps.py b/website/spotify/apps.py new file mode 100644 index 0000000..b0d70c6 --- /dev/null +++ b/website/spotify/apps.py @@ -0,0 +1,11 @@ +from django.apps import AppConfig +from health_check.plugins import plugin_dir + + +class SpotifyAppConfig(AppConfig): + name = "website.spotify" + + def ready(self) -> None: + from .healthchecks import SpotifyHealthCheckBackend + + plugin_dir.register(SpotifyHealthCheckBackend) diff --git a/website/spotify/healthchecks.py b/website/spotify/healthchecks.py new file mode 100644 index 0000000..937c928 --- /dev/null +++ b/website/spotify/healthchecks.py @@ -0,0 +1,13 @@ +import requests +from django.conf import settings +from health_check.backends import BaseHealthCheckBackend + + +class SpotifyHealthCheckBackend(BaseHealthCheckBackend): + def check_status(self) -> None: + requests.get( + f"https://{settings.SPOTIFY_PROXY_HOST}/.health/" + ).raise_for_status() + + def identifier(self) -> str: + return "Spotify Proxy"