Files
mtusi2026lab2/scripts/bootstrap.sh
T
alenchha 6bec450e20
Application / app (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
ЛР 2: PostgreSQL, сессии в Valkey, трек 2
2026-10-19 19:11:28 +03:00

16 lines
590 B
Bash
Executable File

#!/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"