#!/usr/bin/env bash # Generate .env with strong secrets if missing. set -euo pipefail ROOT="$(cd "$(dirname "$0")" && pwd)" cd "$ROOT" if [[ -f .env ]]; then echo ".env already exists — skip generation" exit 0 fi DB_PASS="$(openssl rand -hex 24)" SECRET_KEY="$(openssl rand -hex 32)" # Gitea internal token format: long base64-ish string INTERNAL_TOKEN="$(openssl rand -base64 48 | tr -d '\n')" ADMIN_PASS="$(openssl rand -base64 24 | tr -d '\n=/+' | head -c 24)" cat > .env < "$CRED" <