mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
A possible explanation for the infrequent CTDs we've been seeing since adding fast forward is that QWebChannel doesn't keep a reference to the python objects that it passes to js, so if the object is GC'd before the front end is done with it, it crashes. We don't really like QWebChannel anyway, so this begins replacing that with FastAPI.
29 lines
828 B
Python
29 lines
828 B
Python
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
class ServerSettings(BaseSettings):
|
|
"""Settings controlling server behavior.
|
|
|
|
The values listed here will be automatically modified based on the environment. e.g.
|
|
running with SERVER_BIND_ADDRESS=0.0.0.0 will cause the server to bind to all
|
|
interfaces.
|
|
|
|
https://fastapi.tiangolo.com/advanced/settings
|
|
"""
|
|
|
|
# WARNING: Be extremely cautious exposing the server to other machines. As there is
|
|
# no client/server workflow yet, security has not been a focus.
|
|
server_bind_address: str = "::1"
|
|
|
|
# If you for some reason change the port, you'll need to also update map.js.
|
|
server_port: int = 5000
|
|
|
|
@classmethod
|
|
@lru_cache
|
|
def get(cls) -> ServerSettings:
|
|
return cls()
|