ЛР 3 — БПИ2303 — Морару — на 5: API на TypeScript/Node, HAProxy, failover, трек 1

This commit is contained in:
celis
2026-10-29 20:59:24 +03:00
parent 0ab3a341aa
commit c4f9eb7648
83 changed files with 1862 additions and 19 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Creates local synthetic credentials and .env once. Never overwrites: the pgdata volume keeps the old password.
set -eu
cd "$(dirname "$0")/.."
[ -f .env ] || cp .env.example .env
if [ -f secrets/postgres_password ]; then
echo "secrets/ already exists, keeping it"
exit 0
fi
mkdir -p secrets
chmod 700 secrets
password=$(openssl rand -hex 24)
printf '%s' "$password" > secrets/postgres_password
printf 'postgres://messenger:%s@postgres:5432/messenger' "$password" > secrets/database_url
chmod 644 secrets/postgres_password secrets/database_url # read by container users; the directory stays 700
echo "created secrets/ and .env"