Stage Engine web UI from legacy assets

This commit is contained in:
2025-10-25 05:11:43 -06:00
parent fa0de57f61
commit 4bac45afe5
8 changed files with 158 additions and 21 deletions

View File

@@ -42,7 +42,7 @@ The Engine mirrors the legacy defaults so it can boot without additional configu
| `BOREALIS_ROOT` | Overrides automatic project root detection. Useful when running from a packaged location. | Directory two levels above `Data/Engine/` |
| `BOREALIS_DATABASE_PATH` | Path to the SQLite database. | `<project_root>/database.db` |
| `BOREALIS_ENGINE_AUTO_MIGRATE` | Run Engine-managed schema migrations during bootstrap (`true`/`false`). | `true` |
| `BOREALIS_STATIC_ROOT` | Directory that serves static assets for the SPA. | First existing path among `Engine/web-interface/build`, `Engine/web-interface/dist`, `Data/Engine/WebUI/build`, `Data/Server/web-interface/build`, `Data/Server/WebUI/build`, `Data/WebUI/build` |
| `BOREALIS_STATIC_ROOT` | Directory that serves static assets for the SPA. | First existing path among `Engine/web-interface/build`, `Engine/web-interface/dist`, `Data/Engine/web-interface/build`, `Data/Server/WebUI/build`, `Data/Server/web-interface/build`, `Data/WebUI/build` |
| `BOREALIS_CORS_ALLOWED_ORIGINS` | Comma-delimited list of origins granted CORS access. Use `*` for all origins. | `*` |
| `BOREALIS_FLASK_SECRET_KEY` | Secret key for Flask session signing. | `change-me` |
| `BOREALIS_DEBUG` | Enables debug logging, disables secure-cookie requirements, and allows Werkzeug debug mode. | `false` |
@@ -55,6 +55,12 @@ The Engine mirrors the legacy defaults so it can boot without additional configu
| `BOREALIS_CERTIFICATES_ROOT` | Overrides where TLS certificates (root CA + leaf) are stored. | `<project_root>/Certificates` |
| `BOREALIS_SERVER_CERT_ROOT` | Directly points to the Engine server certificate directory if certificates are staged elsewhere. | `<project_root>/Certificates/Server` |
The launch scripts (`Borealis.ps1` / `Borealis.sh`) automatically synchronize
`Data/Server/WebUI` into `Data/Engine/web-interface` when the Engines copy is
missing. The repository keeps that directory mostly empty (except for
documentation) so Git history does not duplicate the large SPA payload, but the
runtime staging still ensures Vite reads from the Engine tree.
## TLS and transport stack
`Data/Engine/services/crypto/certificates.py` mirrors the legacy certificate

View File

@@ -120,16 +120,14 @@ def _resolve_static_root(project_root: Path) -> Path:
project_root / "Engine" / "web-interface" / "build",
project_root / "Engine" / "web-interface" / "dist",
project_root / "Engine" / "web-interface",
project_root / "Data" / "Engine" / "WebUI" / "build",
project_root / "Data" / "Engine" / "WebUI",
project_root / "Data" / "Engine" / "web-interface" / "build",
project_root / "Data" / "Engine" / "web-interface",
project_root / "Server" / "web-interface" / "build",
project_root / "Server" / "web-interface",
project_root / "Server" / "WebUI" / "build",
project_root / "Server" / "WebUI",
project_root / "Data" / "Server" / "web-interface" / "build",
project_root / "Data" / "Server" / "web-interface",
project_root / "Data" / "Server" / "WebUI" / "build",
project_root / "Data" / "Server" / "WebUI",
project_root / "Data" / "Server" / "web-interface" / "build",
project_root / "Data" / "Server" / "web-interface",
project_root / "Data" / "WebUI" / "build",
project_root / "Data" / "WebUI",
)

View File

@@ -46,27 +46,27 @@ def test_static_root_env_override(tmp_path, monkeypatch):
monkeypatch.delenv("BOREALIS_ROOT", raising=False)
def test_static_root_falls_back_to_legacy_source(tmp_path, monkeypatch):
"""Legacy WebUI source should be served when no build assets exist."""
def test_static_root_falls_back_to_engine_source(tmp_path, monkeypatch):
"""Engine data assets should serve when no build output exists."""
legacy_source = tmp_path / "Data" / "Server" / "WebUI"
legacy_source.mkdir(parents=True)
(legacy_source / "index.html").write_text("<html></html>", encoding="utf-8")
engine_source = tmp_path / "Data" / "Engine" / "web-interface"
engine_source.mkdir(parents=True)
(engine_source / "index.html").write_text("<html></html>", encoding="utf-8")
monkeypatch.setenv("BOREALIS_ROOT", str(tmp_path))
monkeypatch.delenv("BOREALIS_STATIC_ROOT", raising=False)
settings = load_environment()
assert settings.flask.static_root == legacy_source.resolve()
assert settings.flask.static_root == engine_source.resolve()
monkeypatch.delenv("BOREALIS_ROOT", raising=False)
def test_static_root_considers_runtime_copy(tmp_path, monkeypatch):
"""Runtime Server/WebUI copies should be considered when Data assets are missing."""
"""Runtime Server/web-interface copies should be considered when Data assets are missing."""
runtime_source = tmp_path / "Server" / "WebUI"
runtime_source = tmp_path / "Server" / "web-interface"
runtime_source.mkdir(parents=True)
(runtime_source / "index.html").write_text("runtime", encoding="utf-8")
@@ -76,7 +76,22 @@ def test_static_root_considers_runtime_copy(tmp_path, monkeypatch):
settings = load_environment()
assert settings.flask.static_root == runtime_source.resolve()
monkeypatch.delenv("BOREALIS_ROOT", raising=False)
def test_static_root_falls_back_to_legacy_assets(tmp_path, monkeypatch):
"""Legacy Data/Server/WebUI assets remain a valid fallback."""
legacy_source = tmp_path / "Data" / "Server" / "WebUI"
legacy_source.mkdir(parents=True)
(legacy_source / "index.html").write_text("legacy", encoding="utf-8")
monkeypatch.setenv("BOREALIS_ROOT", str(tmp_path))
monkeypatch.delenv("BOREALIS_STATIC_ROOT", raising=False)
settings = load_environment()
assert settings.flask.static_root == legacy_source.resolve()
monkeypatch.delenv("BOREALIS_ROOT", raising=False)

3
Data/Engine/web-interface/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*
!.gitignore
!README.md

View File

@@ -0,0 +1,10 @@
# Engine Web Interface Staging
The Engine server reuses the existing Vite single-page application that still lives under
`Data/Server/WebUI`. At runtime the launch scripts copy those assets into this directory so the
Engine can stage its own copy without disturbing the legacy server.
The repository intentionally ignores the staged files to avoid duplicating tens of thousands of
lines (and large binary assets) in source control. If you need to refresh the Engine copy, run one
of the launch scripts (`Borealis.ps1` or `Borealis.sh`) or copy the assets manually from
`Data/Server/WebUI` into this folder.