#!/usr/bin/env bash # # generate_env.sh # # Generates a Biergarten App environment file with freshly randomized # secrets (DB password, JWT signing secrets, SMTP credentials), based on # the .env.example template. Non-secret configuration values are left # untouched so the file still matches the documented template structure. # # Usage: # ./generate_env.sh [output_file] [template_file] # # output_file Path to write the generated env file to (default: .env) # template_file Path to the source template (default: .env.example) #!/usr/bin/env bash set -euo pipefail OUTPUT_FILE="${1:-.env}" TEMPLATE_FILE="${2:-.env.example}" if ! command -v openssl >/dev/null 2>&1; then echo "Error: openssl is required but was not found on PATH." >&2 exit 1 fi if [[ ! -f "$TEMPLATE_FILE" ]]; then echo "Error: template file '$TEMPLATE_FILE' not found." >&2 echo "Pass the template path explicitly: ./generate_env.sh