's'
This commit is contained in:
@@ -9,7 +9,7 @@ Windows / macOS 本地开发:SSH 隧道把线上 MinIO/PocketBase 映射到本
|
||||
用法:
|
||||
python scripts/dev-tunnel.py
|
||||
|
||||
环境变量(可写在 .env.local):
|
||||
环境变量(推荐写在 cursor.env,也可写在 .env.local):
|
||||
DEV_SSH_HOST=82.157.112.245
|
||||
DEV_SSH_USER=ubuntu
|
||||
DEV_SSH_PASSWORD=你的密码
|
||||
@@ -35,26 +35,7 @@ except ImportError:
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def _read_env_file(path: Path) -> dict[str, str]:
|
||||
values: dict[str, str] = {}
|
||||
if not path.exists():
|
||||
return values
|
||||
for raw in path.read_text(encoding="utf-8").splitlines():
|
||||
line = raw.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
key, value = line.split("=", 1)
|
||||
values[key.strip()] = value.strip().strip('"').strip("'")
|
||||
return values
|
||||
|
||||
|
||||
def load_env() -> None:
|
||||
merged: dict[str, str] = {}
|
||||
for path in [ROOT / ".env.local", ROOT / ".env", ROOT / "backend" / ".env"]:
|
||||
merged.update(_read_env_file(path))
|
||||
for key, value in merged.items():
|
||||
os.environ.setdefault(key, value)
|
||||
from load_dev_env import load_dev_env as load_env # noqa: E402
|
||||
|
||||
|
||||
def forward_tunnel(local_port: int, remote_host: str, remote_port: int, transport) -> None:
|
||||
|
||||
Reference in New Issue
Block a user