This repository has been archived on 2025-09-28. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
transcript_api/transcriptapi/env.py

22 lines
774 B
Python

# Copyright (c) 2024 Julian Müller (ChaoticByte)
from os import environ as _environ
from pathlib import Path as _Path
from .msg import ComponentLogger as _ComponentLogger
_logger = _ComponentLogger("Environment", print_timestamp=False)
try:
ACCESS_CONTROL_ALLOW_ORIGIN = str(_environ["ACCESS_CONTROL_ALLOW_ORIGIN"])
API_STT_MODEL = _Path(_environ["API_STT_MODEL"])
API_STT_THREADS = int(_environ.get("API_STT_THREADS", 4)) # per worker
# log stt config
_logger.info("STT Configuration:")
_logger.info(f" Model: {API_STT_MODEL}")
_logger.info(f" Threads: {API_STT_THREADS} per worker")
except KeyError as e:
_logger.critical(f"Missing {e}")
exit(1)
except Exception as e:
_logger.critical(f"An exception occured: {e}")
exit(1)