fix: resolve_auth file password log prints actual path, not module name
Add `get_password_path` to top-level imports in main.py and fix the file password resolution branch to log the actual file path instead of `load_password.__module__` (which printed "muxplex.auth"). Also adds 4 tests covering all _resolve_auth logging paths: - test_resolve_auth_pam_mode_logs_pam - test_resolve_auth_env_password_logs_env - test_resolve_auth_file_password_logs_file - test_resolve_auth_generates_password_as_last_resort
This commit is contained in:
+2
-3
@@ -33,6 +33,7 @@ from muxplex.auth import (
|
||||
authenticate_pam,
|
||||
create_session_cookie,
|
||||
generate_and_save_password,
|
||||
get_password_path,
|
||||
load_or_create_secret,
|
||||
load_password,
|
||||
pam_available,
|
||||
@@ -221,15 +222,13 @@ def _resolve_auth() -> tuple[str, str]:
|
||||
file_pw = load_password()
|
||||
if file_pw:
|
||||
print(
|
||||
f" muxplex auth: password (file: {load_password.__module__})",
|
||||
f" muxplex auth: password (file: {get_password_path()})",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return "password", file_pw
|
||||
|
||||
# Last resort: auto-generate
|
||||
generated = generate_and_save_password()
|
||||
from muxplex.auth import get_password_path
|
||||
|
||||
print(
|
||||
f" muxplex auth: password generated — {generated} — saved to {get_password_path()}",
|
||||
file=sys.stderr,
|
||||
|
||||
Reference in New Issue
Block a user