phonegpu-space / app /core /config.py
josephrw's picture
Upload folder using huggingface_hub
d958e80 verified
Raw
History Blame Contribute Delete
920 Bytes
import os
class Settings:
@staticmethod
def get_public_url() -> str:
url = os.getenv("SPACE_PUBLIC_URL", "")
if not url:
url = os.getenv("SPACE_HOST", "")
if url:
url = f"https://{url}"
if not url:
# Local development fallback
port = os.getenv("PORT", "7860")
url = f"http://127.0.0.1:{port}"
return url
@staticmethod
def get_session_ttl_seconds() -> int:
return int(os.getenv("SESSION_TTL_SECONDS", "3600"))
@staticmethod
def get_job_ttl_seconds() -> int:
return int(os.getenv("JOB_TTL_SECONDS", "300"))
@staticmethod
def get_max_payload_bytes() -> int:
return int(os.getenv("MAX_PAYLOAD_BYTES", "10485760"))
@staticmethod
def is_signature_required() -> bool:
return os.getenv("REQUIRE_DEVICE_SIGNATURES", "false").lower() == "true"