ЛР 3 — балансировка и отказ API-реплики

This commit is contained in:
Риц Дмитрий
2026-11-06 02:45:37 +03:00
parent 0ab3a341aa
commit 6dada9a6d0
34 changed files with 2245 additions and 36 deletions
+15
View File
@@ -0,0 +1,15 @@
"""Generate local Compose secrets once, without printing them."""
from pathlib import Path
from secrets import token_hex
root = Path(__file__).resolve().parents[1]
example = (root / ".env.example").read_text(encoding="utf-8")
try:
with (root / ".env").open("x", encoding="utf-8", newline="\n") as target:
target.write(example.replace("POSTGRES_PASSWORD=\n", f"POSTGRES_PASSWORD={token_hex(24)}\n")
.replace("CURSOR_SECRET=\n", f"CURSOR_SECRET={token_hex(32)}\n"))
except FileExistsError:
print("Using the existing .env")
else:
print("Created local .env")