mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 22:01:59 -06:00
Refine Engine bootstrap logging
This commit is contained in:
11
Data/Engine/interfaces/__init__.py
Normal file
11
Data/Engine/interfaces/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Interface adapters (HTTP, WebSocket, etc.) for the Borealis Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .http import register_http_interfaces
|
||||
from .ws import create_socket_server
|
||||
|
||||
__all__ = [
|
||||
"register_http_interfaces",
|
||||
"create_socket_server",
|
||||
]
|
||||
18
Data/Engine/interfaces/http/__init__.py
Normal file
18
Data/Engine/interfaces/http/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""HTTP interface registration for the Borealis Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from flask import Flask
|
||||
|
||||
|
||||
def register_http_interfaces(app: Flask) -> None:
|
||||
"""Attach HTTP blueprints to *app*.
|
||||
|
||||
The implementation is intentionally minimal for the initial scaffolding.
|
||||
"""
|
||||
|
||||
# Future phases will import and register blueprints here.
|
||||
return None
|
||||
|
||||
|
||||
__all__ = ["register_http_interfaces"]
|
||||
34
Data/Engine/interfaces/ws/__init__.py
Normal file
34
Data/Engine/interfaces/ws/__init__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""WebSocket interface factory for the Borealis Engine."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from ...config import EngineSettings
|
||||
|
||||
try: # pragma: no cover - import guard
|
||||
from flask_socketio import SocketIO
|
||||
except Exception: # pragma: no cover - optional dependency
|
||||
SocketIO = None # type: ignore[assignment]
|
||||
|
||||
|
||||
def create_socket_server(app: Flask, settings: EngineSettings) -> Optional[SocketIO]:
|
||||
"""Create a Socket.IO server bound to *app* if dependencies are available."""
|
||||
|
||||
if SocketIO is None:
|
||||
return None
|
||||
|
||||
cors_allowed = settings.cors_allowed_origins or ("*",)
|
||||
socketio = SocketIO(
|
||||
app,
|
||||
cors_allowed_origins=cors_allowed,
|
||||
async_mode=None,
|
||||
logger=False,
|
||||
engineio_logger=False,
|
||||
)
|
||||
return socketio
|
||||
|
||||
|
||||
__all__ = ["create_socket_server"]
|
||||
Reference in New Issue
Block a user