Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions backend/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ def _get_env(var: str, fallback: str | None = None) -> str | None:
"TINFOIL_WELCOME_MESSAGE", "RomM Switch Library"
)

# EMULATOR STREAMING
STREAMING_BROKER_SECRET: Final[str] = _get_env("STREAMING_BROKER_SECRET", "")
STREAMING_SAVE_TIMEOUT: Final[int] = safe_int(
_get_env("STREAMING_SAVE_TIMEOUT"), 45
) # 45 seconds

# SENTRY
SENTRY_DSN: Final[str | None] = _get_env("SENTRY_DSN")

Expand Down
21 changes: 21 additions & 0 deletions backend/config/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ class NetplayICEServer(TypedDict):
credential: NotRequired[str]


class StreamingContainer(TypedDict):
platform: str
host: str
broker_host: str
label: str


class Config:
CONFIG_FILE_MOUNTED: bool
CONFIG_FILE_WRITABLE: bool
Expand Down Expand Up @@ -136,6 +143,8 @@ class Config:
SCAN_MEDIA: list[str]
GAMELIST_MEDIA_THUMBNAIL: MetadataMediaType
GAMELIST_MEDIA_IMAGE: MetadataMediaType
STREAMING_ENABLED: bool
STREAMING_CONTAINERS: list[StreamingContainer]

def __init__(self, **entries):
self.__dict__.update(entries)
Expand Down Expand Up @@ -456,6 +465,10 @@ def _parse_config(self):
PEGASUS_AUTO_EXPORT_ON_SCAN=pydash.get(
self._raw_config, "scan.pegasus.export", False
),
STREAMING_ENABLED=pydash.get(self._raw_config, "streaming.enabled", False),
STREAMING_CONTAINERS=pydash.get(
self._raw_config, "streaming.containers", []
),
)

def _get_ejs_controls(self) -> dict[str, EjsControls]:
Expand Down Expand Up @@ -726,6 +739,14 @@ def _validate_config(self):
)
self.config.GAMELIST_MEDIA_IMAGE = MetadataMediaType.SCREENSHOT

if not isinstance(self.config.STREAMING_ENABLED, bool):
log.critical("Invalid config.yml: streaming.enabled must be a boolean")
sys.exit(3)

if not isinstance(self.config.STREAMING_CONTAINERS, list):
log.critical("Invalid config.yml: streaming.containers must be a list")
sys.exit(3)

def get_config(self) -> Config:
try:
with open(self.config_file, "r") as config_file:
Expand Down
Loading
Loading