Реализовать лабораторную работу 3

This commit is contained in:
Никита
2026-11-02 18:55:53 +03:00
parent 0ab3a341aa
commit d2ff198781
109 changed files with 25218 additions and 27 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
umask 077
mkdir -p secrets
if [ -e secrets/postgres_password ] || [ -e secrets/database_url ]; then
if [ ! -s secrets/postgres_password ] || [ ! -s secrets/database_url ]; then
printf '%s\n' 'Incomplete secrets directory; repair it manually without replacing an existing database password.' >&2
exit 1
fi
exit 0
fi
password="$(openssl rand -hex 24)"
printf '%s' "$password" > secrets/postgres_password
printf 'Host=postgres;Port=5432;Database=messenger;Username=messenger;Password=%s' "$password" > secrets/database_url
printf '%s\n' 'Created local database secrets in ignored secrets/ directory.'