Files
gitlab-instance-0a899031_lo…/_gps_ssh_auth.py
2026-04-05 01:00:07 -05:00

16 lines
500 B
Python
Raw Permalink 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.
"""SSH 密码:环境变量 FL_SSH_PASS否则读 gps 目录下 fl_ssh_pass.txt / .fl_ssh_pass单行"""
import os
def ssh_password(gps_root: str) -> str:
p = os.environ.get("FL_SSH_PASS", "").strip()
if p:
return p
for name in ("fl_ssh_pass.txt", ".fl_ssh_pass"):
path = os.path.join(gps_root, name)
if os.path.isfile(path):
with open(path, encoding="utf-8", errors="replace") as f:
return f.read().strip()
return ""