29 lines
999 B
Python
29 lines
999 B
Python
"""ReinLoop cloud-server endpoint configuration shared by core modules."""
|
|
|
|
import os
|
|
|
|
from license_utils import get_verified_license
|
|
|
|
|
|
base_url = os.environ.get(
|
|
"REINLOOP_SERVER_URL",
|
|
"https://ReinLoop.dominatedconvergence.com",
|
|
).rstrip("/")
|
|
server_api_url = os.environ.get(
|
|
"REINLOOP_API_URL",
|
|
f"{base_url}/api",
|
|
)
|
|
# Compatibility alias used by existing modules. It points to the ReinLoop
|
|
# Express server API, not a cloud-function endpoint.
|
|
data_record_url = server_api_url
|
|
_license = get_verified_license()
|
|
_license_device_id = (_license or {}).get("device_id", "").strip()
|
|
_environment_device_id = os.environ.get("REINLOOP_DEVICE_ID", "").strip()
|
|
|
|
if _license_device_id and _environment_device_id and _license_device_id != _environment_device_id:
|
|
raise RuntimeError("REINLOOP_DEVICE_ID 与许可证 device_id 不一致")
|
|
|
|
the_folder = _license_device_id or _environment_device_id or "local-test-device"
|
|
|
|
if not the_folder:
|
|
raise RuntimeError("设备 ID 不能为空") |