oclaw/platform/config/passwords.py
oliver ba3836f00f 初始化:独立 oclaw 仓库首提交
- 在 oclaw/ 下重新初始化 Git 仓库
- 补齐子仓库 .gitignore,避免提交本地运行态数据(_local、node_modules、logs 等)
- 提交当前工程代码与配置

Made-with: Cursor
2026-04-24 22:31:22 +08:00

21 lines
687 B
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.

"""访问密码解析(环境变量 + 数据库);Streamlit secrets 在认证模块中处理。"""
from __future__ import annotations
import os
from oclaw.platform.persistence.sqlite_store import SqliteStore
def load_expected_password(store: SqliteStore, *, extra_candidate: str | None = None) -> str | None:
pwd = (os.getenv("AIA_ASSISTANT_PASSWORD") or "").strip()
if not pwd:
pwd = (os.getenv("OPS_ASSISTANT_PASSWORD") or "").strip()
if not pwd and extra_candidate:
pwd = extra_candidate.strip()
if not pwd:
pwd = (store.get_secret("auth_password") or "").strip()
return pwd if pwd else None
__all__ = ["load_expected_password"]