's'
This commit is contained in:
15
_gps_ssh_auth.py
Normal file
15
_gps_ssh_auth.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""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 ""
|
||||
Reference in New Issue
Block a user