forked from mtusi2026/mtusi2026lab2
Bring the application, own tests, Dockerfile, toolchain, compose stack, migrations, secret generator, restart hook, evidence scripts and CI job from the lab 2 solution commit 8cddb09 unchanged, merge the lab 2 Makefile targets into the lab 3 skeleton Makefile without touching its targets, and append the lab 2 solution variables to the skeleton .env.example. The package version follows the contract version 1.3.0. This is the starting point of the lab 3 cycle: lint, own tests and the offline skeleton check pass before any lab 3 change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
21 lines
700 B
Bash
Executable File
21 lines
700 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
umask 077
|
|
mkdir -p secrets
|
|
random() { od -An -N32 -tx1 /dev/urandom | tr -d ' \n'; }
|
|
put() {
|
|
if [ ! -s "secrets/$1" ]; then
|
|
printf '%s' "$2" > "secrets/$1"
|
|
chmod 644 "secrets/$1"
|
|
echo "создан secrets/$1"
|
|
fi
|
|
}
|
|
put postgres_password "$(random)"
|
|
put database_url "postgresql://messenger:$(cat secrets/postgres_password)@postgres:5432/messenger"
|
|
put cursor_secret "$(random)"
|
|
put valkey_password "$(random)"
|
|
put valkey.conf "requirepass $(cat secrets/valkey_password)"
|
|
put cache_url "redis://:$(cat secrets/valkey_password)@valkey:6379/0"
|
|
[ -f .env ] || { cp .env.example .env; echo "создан .env из .env.example"; }
|