(20241226) Started working on the server management system.

This commit is contained in:
2024-12-25 19:48:25 +05:30
parent 7607a427a6
commit 5051f73725
5 changed files with 446 additions and 630 deletions
+19
View File
@@ -67,9 +67,13 @@ from utils_v2.api.async_quart import (
# For debugging:
from icecream import IceCreamDebugger
# Controllers:
from controllers.servers.server import CoreServerController
# All the blueprints:
from api_v2.blueprints.cred_and_data.blueprint import cred_and_data_bp
from api_v2.blueprints.logs.blueprint import logs_bp
from api_v2.blueprints.servers.blueprint import servers_bp
# *****************************************************************************************************************
@@ -96,6 +100,7 @@ app = Quart(__name__)
app = cors(app)
app.register_blueprint(cred_and_data_bp, url_prefix = f"/{MODULE_BASE}")
app.register_blueprint(logs_bp, url_prefix = f"/{MODULE_BASE}/logs")
app.register_blueprint(servers_bp, url_prefix = f"/{MODULE_BASE}/servers")
# *****************************************************************************************************************
@@ -124,6 +129,10 @@ async def app_startup(**kwargs):
:return: None.
"""
# ┳ • • ┓•
# ┃┏┓┓╋┓┏┓┃┓┓┏┓
# ┻┛┗┗┗┗┗┻┗┗┗┗
# Safe-halt mechanism for upgrades (for a single-worker run):
current_app.is_under_maintenance = False
@@ -148,6 +157,16 @@ async def app_startup(**kwargs):
filter = {"scriptId": script_id}
))["content"]
# ┏┓ ┓┓
# ┃ ┏┓┏┓╋┏┓┏┓┃┃┏┓┏┓┏
# ┗┛┗┛┛┗┗┛ ┗┛┗┗┗ ┛ ┛
current_app.server_controller = CoreServerController()
# ┳┳┓•
# ┃┃┃┓┏┏
# ┛ ┗┗┛┗•
# Pick the important stuff:
current_app.whitelisted_ips = current_app.script_data["whitelistedIps"]