ЛР 2: PostgreSQL, сессии в Valkey, трек 2

This commit is contained in:
alenchha
2026-10-19 19:11:28 +03:00
parent 65003b6119
commit 6bec450e20
50 changed files with 3210 additions and 14 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
[ -f .env ] || cp .env.example .env
mkdir -p secrets
if [ ! -f secrets/postgres_password ]; then
python3 -c "import secrets; print(secrets.token_urlsafe(24))" > secrets/postgres_password
fi
password=$(cat secrets/postgres_password)
printf 'postgresql://messenger:%s@postgres:5432/messenger\n' "$password" > secrets/database_url
printf 'valkey://valkey:6379/0\n' > secrets/cache_url
chmod 700 secrets
chmod 600 secrets/postgres_password secrets/database_url secrets/cache_url
echo "ready: .env and secrets/ created locally; they stay out of Git"