chore(solution): port lab3 sources

This commit is contained in:
2026-11-20 03:05:34 +03:00
parent ec540a1a72
commit 083d0d80cc
44 changed files with 2745 additions and 1 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
mkdir -p secrets
chmod 700 secrets
if [ ! -f secrets/postgres_password ]; then
head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n' > secrets/postgres_password
fi
password=$(cat secrets/postgres_password)
[ -f secrets/database_url ] ||
printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable\n' "$password" > secrets/database_url
[ -f secrets/cache_url ] ||
printf 'redis://redis:6379/0\n' > secrets/cache_url
chmod 644 secrets/postgres_password secrets/database_url secrets/cache_url
echo "secrets ready in ./secrets"