-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecker.py
More file actions
33 lines (28 loc) · 1.24 KB
/
checker.py
File metadata and controls
33 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This fill will check everything that need for all the services.
# If check failed then the server will not be able to start.
import os
import logger
import importlib
__log = logger.Logger("checker", True)
def checkServicesRequirements():
services = os.listdir(os.path.join(os.getcwd(), "Services"))
__log.printinfo(f"Found {len(services)} services, checking requirements...")
for i in services:
serviceModule = importlib.import_module(f"Services.{i}.{i}")
if serviceModule.preloadCheck() == False:
__log.printerror(f"Service <{i}> failed to pass preload check, server will not be able to start.")
return False
else:
__log.printinfo(f"Service <{i}> passed preload check.")
continue
__log.printinfo("All services passed preload check.")
return True
def autoRegisterRouters(app):
routers = os.listdir(os.path.join(os.getcwd(), "Routers"))
__log.printinfo(f"Found {len(routers)} routers, auto registering...")
for i in routers:
routerModule = importlib.import_module(f"Routers.{i}.{i}")
app.register_blueprint(routerModule.router)
__log.printinfo(f"Router <{i}> registered.")
__log.printinfo("All routers registered.")
return app