Add healthcheck for Spotify proxy
This commit is contained in:
parent
96a6ded02e
commit
0541f6ce22
2 changed files with 24 additions and 0 deletions
11
website/spotify/apps.py
Normal file
11
website/spotify/apps.py
Normal file
|
@ -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)
|
13
website/spotify/healthchecks.py
Normal file
13
website/spotify/healthchecks.py
Normal file
|
@ -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"
|
Loading…
Reference in a new issue