ЛР2: PostgreSQL, сессии и Valkey на оценку 4

This commit is contained in:
gera
2026-10-16 00:50:33 +03:00
parent 65003b6119
commit f612fbef77
32 changed files with 2339 additions and 21 deletions
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -eu
ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
mkdir -p "$ROOT/secrets"
if [ ! -f "$ROOT/secrets/postgres_password" ]; then
openssl rand -base64 24 | tr -d '\n' > "$ROOT/secrets/postgres_password"
fi
PASS=$(cat "$ROOT/secrets/postgres_password")
ENC=$(printf '%s' "$PASS" | python3 -c 'import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read(), safe=""))')
printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable\n' "$ENC" > "$ROOT/secrets/database_url"
printf 'redis://valkey:6379/0\n' > "$ROOT/secrets/cache_url"
chmod 644 "$ROOT/secrets/"*
echo "secrets ready in $ROOT/secrets"