MCPcopy Create free account
hub / github.com/StarsTom/mobileCodexHelper / resolve_auth_db_path

Function resolve_auth_db_path

mobile_codex_control.py:126–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124
125
126def resolve_auth_db_path() -> Path:
127 candidates = []
128 env_database_path = os.environ.get("DATABASE_PATH")
129 if env_database_path:
130 candidates.append(Path(env_database_path))
131
132 candidates.extend(
133 [
134 WORKSPACE / "vendor" / "claudecodeui-1.25.2" / "server" / "database" / "auth.db",
135 Path.home() / ".cloudcli" / "auth.db",
136 Path.home() / ".codex" / "auth.db",
137 ]
138 )
139
140 best_path = candidates[0]
141 best_score = -1
142 seen: set[str] = set()
143 for candidate in candidates:
144 normalized = str(candidate.resolve()) if candidate.exists() else str(candidate)
145 if normalized in seen:
146 continue
147 seen.add(normalized)
148 score, _tables = inspect_auth_db(candidate)
149 if score > best_score:
150 best_path = candidate
151 best_score = score
152
153 return best_path
154
155
156AUTH_DB_PATH = resolve_auth_db_path()

Callers 1

Calls 1

inspect_auth_dbFunction · 0.85

Tested by

no test coverage detected