fix logging

This commit is contained in:
Hay1tsme 2024-01-11 21:01:51 -05:00
parent fc3f0900b3
commit 9a7d5bc689
4 changed files with 11 additions and 9 deletions

View File

@ -123,9 +123,8 @@ class AllnetServlet:
) )
self.logger.initialized = True self.logger.initialized = True
self.logger.info( def startup(self) -> None:
f"Ready on port {self.config.allnet.port if self.config.allnet.standalone else self.config.server.port}" self.logger.info(f"Ready on port {self.config.allnet.port if self.config.allnet.standalone else self.config.server.port}")
)
async def handle_poweron(self, request: Request): async def handle_poweron(self, request: Request):
request_ip = Utils.get_ip_addr(request) request_ip = Utils.get_ip_addr(request)
@ -471,6 +470,9 @@ class BillingServlet:
) )
self.logger.initialized = True self.logger.initialized = True
def startup(self) -> None:
self.logger.info(f"Ready on port {self.config.billing.port if self.config.billing.standalone else self.config.server.port}")
def billing_req_to_dict(self, data: bytes): def billing_req_to_dict(self, data: bytes):
""" """
Parses an billing request string into a python dictionary Parses an billing request string into a python dictionary
@ -894,7 +896,8 @@ app_billing = Starlette(
[ [
Route("/request", billing.handle_billing_request, methods=["POST"]), Route("/request", billing.handle_billing_request, methods=["POST"]),
Route("/request/", billing.handle_billing_request, methods=["POST"]), Route("/request/", billing.handle_billing_request, methods=["POST"]),
] ],
on_startup=[billing.startup]
) )
allnet = AllnetServlet(cfg, cfg_dir) allnet = AllnetServlet(cfg, cfg_dir)
@ -914,5 +917,6 @@ if cfg.allnet.allow_online_updates:
app_allnet = Starlette( app_allnet = Starlette(
cfg.server.is_develop, cfg.server.is_develop,
route_lst route_lst,
on_startup=[allnet.startup]
) )

View File

@ -54,8 +54,6 @@ title = TitleServlet(cfg, cfg_dir) # This has to be loaded first to load plugins
mucha = MuchaServlet(cfg, cfg_dir) mucha = MuchaServlet(cfg, cfg_dir)
route_lst: List[Route] = [ route_lst: List[Route] = [
# Allnet
# Mucha # Mucha
Route("/mucha_front/boardauth.do", mucha.handle_boardauth, methods=["POST"]), Route("/mucha_front/boardauth.do", mucha.handle_boardauth, methods=["POST"]),
Route("/mucha_front/updatacheck.do", mucha.handle_updatecheck, methods=["POST"]), Route("/mucha_front/updatacheck.do", mucha.handle_updatecheck, methods=["POST"]),

View File

@ -144,7 +144,7 @@ class FrontendServlet():
Route("/robots.txt", self.robots) Route("/robots.txt", self.robots)
] ]
def startup(self) -> None: def startup(self) -> None:
self.config.update({ self.config.update({
"frontend": { "frontend": {
"standalone": True, "standalone": True,

View File

@ -22,7 +22,7 @@ if __name__ == "__main__":
parser.add_argument("--email", "-e", type=str, help="Email for the new user") parser.add_argument("--email", "-e", type=str, help="Email for the new user")
parser.add_argument("--access_code", "-a", type=str, help="Access code for new/transfer user", default="00000000000000000000") parser.add_argument("--access_code", "-a", type=str, help="Access code for new/transfer user", default="00000000000000000000")
parser.add_argument("--message", "-m", type=str, help="Revision message") parser.add_argument("--message", "-m", type=str, help="Revision message")
parser.add_argument("action", type=str, help="create, upgrade, create-owner") parser.add_argument("action", type=str, help="create, upgrade, create-owner, migrate, create-revision")
args = parser.parse_args() args = parser.parse_args()
cfg = CoreConfig() cfg = CoreConfig()