#!/usr/bin/env bash set -euo pipefail umask 077 env_file=${1:-/opt/merchantflow/production.env} if [[ -e "$env_file" ]]; then echo "Refusing to overwrite existing configuration: $env_file" >&2 exit 1 fi command -v openssl >/dev/null password=$(openssl rand -hex 32) mkdir -p "$(dirname "$env_file")" # noclobber also protects against a concurrent initialization. set -o noclobber cat > "$env_file" <