mirror of
https://github.com/StefBuwalda/dashboard_test.git
synced 2025-10-30 11:19:58 +00:00
Split up the updating of service status and serving requests into two threads.
This commit is contained in:
33
mem/__init__.py
Normal file
33
mem/__init__.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
|
||||
class service:
|
||||
url: str
|
||||
status: Optional[int]
|
||||
online: bool
|
||||
public: bool
|
||||
|
||||
def __init__(self, url: str = "", public: bool = True):
|
||||
self.url = url
|
||||
self.public = public
|
||||
|
||||
self.online = False
|
||||
self.status = None
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {
|
||||
"url": self.url,
|
||||
"status": self.status,
|
||||
"public": self.public,
|
||||
"online": self.online,
|
||||
}
|
||||
|
||||
def set_status(self, status: int):
|
||||
self.status = status
|
||||
|
||||
|
||||
services: list[service] = [
|
||||
service("https://git.ihatemen.uk"),
|
||||
service("https://plex.ihatemen.uk"),
|
||||
service("https://truenas.local", False),
|
||||
]
|
||||
Reference in New Issue
Block a user