Files
Sankofa/scripts/load-env.sh

21 lines
694 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# load-env.sh
# Helper script to load environment variables from .env file
if [ -f .env ]; then
# Export variables from .env file
# This handles comments and empty lines
set -a
source <(grep -v '^#' .env | grep -v '^$' | sed 's/^/export /')
set +a
# Also set CLOUDFLARE_API_TOKEN from Global API Key if not set
if [ -z "${CLOUDFLARE_API_TOKEN:-}" ] && [ -n "${CLOUDFLARE_API_KEY:-}" ] && [ -n "${CLOUDFLARE_EMAIL:-}" ]; then
# For scripts that need API Token, we can use Global API Key + Email
# Some scripts may need the token format, so we'll keep both
export CLOUDFLARE_API_KEY
export CLOUDFLARE_EMAIL
fi
fi