#!/bin/sh # Generates local synthetic credentials in ./secrets (git-ignored). Safe to re-run: keeps existing files. set -eu cd "$(dirname "$0")/.." mkdir -p secrets umask 077 rand() { python3 -c 'import secrets; print(secrets.token_urlsafe(24))'; } if [ ! -f secrets/postgres_password ]; then pg=$(rand) printf '%s' "$pg" > secrets/postgres_password printf 'postgresql://messenger:%s@postgres:5432/messenger' "$pg" > secrets/database_url fi if [ ! -f secrets/valkey_auth.conf ]; then vk=$(rand) printf 'requirepass %s\n' "$vk" > secrets/valkey_auth.conf printf 'redis://:%s@valkey:6379/0' "$vk" > secrets/cache_url fi # containers run as non-root users and read these via bind-mounted secrets chmod 644 secrets/* echo "secrets ready in ./secrets (values not printed)"