#!/usr/bin/env bash set -euo pipefail ensure_local_env_file() { local env_dir=$1 local example_env_file="$env_dir/.env.example" local local_env_file="$env_dir/.env.local" if [[ -f "$local_env_file" ]]; then return fi if [[ ! -f "$example_env_file" ]]; then printf 'Missing env template: %s\n' "$example_env_file" >&2 exit 1 fi cp "$example_env_file" "$local_env_file" printf 'Created %s from %s\n' "$local_env_file" "$example_env_file" }