nomadro/apps/api/services/social_svc/config.py
Eric 92bbee3c6c Ship native social weapp: immersive hall chat, SRS live, join pay.
Wire Taro social pages to social_svc (Centrifugo + live RTMP), drop multi-channel chat chrome, and add weapp WXSS sanitize/deploy helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 12:33:35 +08:00

39 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
import os
from pathlib import Path
# 默认写在仓库 data/social,与 PocketBase / community 目录分离
_ROOT = Path(__file__).resolve().parents[4] # nomadro/
_DEFAULT_DB = _ROOT / "data" / "social" / "social.db"
SOCIAL_DB_PATH = Path(os.getenv("SOCIAL_DB_PATH", str(_DEFAULT_DB))).resolve()
SOCIAL_ENABLED = os.getenv("SOCIAL_ENABLED", "true").lower() in {"1", "true", "yes", "on"}
# Centrifugo(实时层;缺省关,部署后用环境变量打开)
CENTRIFUGO_ENABLED = os.getenv("CENTRIFUGO_ENABLED", "false").lower() in {"1", "true", "yes", "on"}
CENTRIFUGO_API_URL = os.getenv("CENTRIFUGO_API_URL", "http://127.0.0.1:8008/api").rstrip("/")
CENTRIFUGO_API_KEY = os.getenv("CENTRIFUGO_API_KEY", "")
CENTRIFUGO_TOKEN_SECRET = os.getenv("CENTRIFUGO_TOKEN_SECRET", "")
# 浏览器 WebSocket(经 nginx 反代,与门户同域)
CENTRIFUGO_WS_URL = os.getenv(
"CENTRIFUGO_WS_URL",
"wss://nomadro.cn/rt/connection/websocket",
)
# 原生音视频厅(SRS RTMP 推 / HTTP-FLV 拉)— 微信 LivePusher/LivePlayer
LIVE_RTMP_PUSH_BASE = os.getenv(
"LIVE_RTMP_PUSH_BASE",
"rtmp://82.157.112.245/live",
)
LIVE_HTTP_PLAY_BASE = os.getenv(
"LIVE_HTTP_PLAY_BASE",
"https://nomadro.cn/live",
)
LIVE_STREAM_SECRET = os.getenv(
"LIVE_STREAM_SECRET",
os.getenv("CENTRIFUGO_TOKEN_SECRET", "nomadro-live-dev-secret"),
)
LIVE_MAX_PEERS = int(os.getenv("LIVE_MAX_PEERS", "6"))
LIVE_PEER_TTL_SEC = int(os.getenv("LIVE_PEER_TTL_SEC", "45"))