Enable configuration of the server bind address.

A serverconfig.env (or just environment variables) can be set to
override the default bind address/port for the backend. This is passed
to the front end as a query parameter.
This commit is contained in:
Dan Albert
2022-03-07 17:52:33 -08:00
parent a70ab8cc1d
commit baae65919f
4 changed files with 18 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ from PySide2.QtWebEngineWidgets import (
)
from game import Game
from game.server.settings import ServerSettings
from qt_ui.models import GameModel
from .model import MapModel
@@ -61,6 +62,12 @@ class QLiberationMap(QWebEngineView):
url = QUrl.fromLocalFile(
str(Path("resources/ui/map/canvas.html").resolve())
)
server_settings = ServerSettings.get()
host = server_settings.server_bind_address
if host.startswith("::"):
host = f"[{host}]"
port = server_settings.server_port
url.setQuery(f"server={host}:{port}")
self.page.load(url)
self.setPage(self.page)