Feat: Backend scaffolding and local dev stack
This commit is contained in:
21
Commands/Local/Dev/scripts/env.sh
Normal file
21
Commands/Local/Dev/scripts/env.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/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"
|
||||
}
|
||||
Reference in New Issue
Block a user