ЛР 2: PostgreSQL, сессии и Valkey — на 4
Student application / application (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-23 18:17:09 +03:00
parent 65003b6119
commit 18b419cda2
60 changed files with 1838 additions and 14 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
mkdir -p secrets
chmod 700 secrets
umask 077
if [ ! -f secrets/postgres_password ]; then
od -An -N32 -tx1 /dev/urandom | tr -d ' \n' > secrets/postgres_password
fi
password=$(cat secrets/postgres_password)
for file in secrets/database_url secrets/cache_url; do
[ ! -f "$file" ] || chmod u+w "$file"
done
printf 'postgresql://messenger:%s@postgres:5432/messenger' "$password" > secrets/database_url
printf 'redis://valkey:6379/0' > secrets/cache_url
# The parent directory protects host access; bind-mounted files must be readable
# by the non-root API user inside its container (Compose file secrets preserve modes).
chmod 444 secrets/postgres_password secrets/database_url secrets/cache_url
[ -f .env ] || cp .env.example .env
printf '%s\n' 'Local configuration ready; secrets were not printed.'