fix: clearer LICENSE_CLIENT_KEY setup and ignore empty env overrides.
license.env now fills blank LICENSE_* values; error text points to copying license.env.example. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -46,9 +46,13 @@ def _load_license_env() -> None:
|
||||
continue
|
||||
key, value = raw.split("=", 1)
|
||||
key = key.strip().lstrip("\ufeff")
|
||||
if not key or key in os.environ:
|
||||
if not key:
|
||||
continue
|
||||
os.environ[key] = value.strip().strip('"').strip("'")
|
||||
val = value.strip().strip('"').strip("'")
|
||||
# 仅在未设置或为空时写入,避免空 LICENSE_CLIENT_KEY= 挡住 license.env
|
||||
if (os.environ.get(key) or "").strip():
|
||||
continue
|
||||
os.environ[key] = val
|
||||
|
||||
|
||||
def api_base_url() -> str:
|
||||
@@ -158,7 +162,7 @@ def _parse_expires_at(value: str | None) -> float | None:
|
||||
def _http_json(method: str, path: str, body: dict[str, Any]) -> dict[str, Any]:
|
||||
key = client_key()
|
||||
if not key:
|
||||
return {"ok": False, "message": "未配置 LICENSE_CLIENT_KEY(与授权站 CLIENT_API_KEY 一致)"}
|
||||
return {"ok": False, "message": "未配置 LICENSE_CLIENT_KEY。请在仓库根目录复制 license.env.example 为 license.env,填入与授权站相同的 CLIENT_API_KEY,然后重启服务。"}
|
||||
url = f"{api_base_url()}{path}"
|
||||
payload = json.dumps(body).encode("utf-8")
|
||||
req = Request(
|
||||
|
||||
Reference in New Issue
Block a user