forked from mtusi2026/mtusi2026lab2
ЛР 2: PostgreSQL, сессии в Valkey, трек 2
This commit is contained in:
Executable
+15
@@ -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"
|
||||
Reference in New Issue
Block a user