fix: local dev setup, encryption key generation, and pnpm lockfile

This commit is contained in:
courtmanr@gmail.com 2025-11-19 14:48:09 +00:00
parent 8e07b831a3
commit a39fdc9e99
3 changed files with 9 additions and 5 deletions

Binary file not shown.

View file

@ -166,7 +166,7 @@ if [[ -f "${ROOT_DIR}/mock.env" ]]; then
else
# Sync production config when not in mock mode
echo "Syncing production configuration..."
"${ROOT_DIR}/scripts/sync-production-config.sh"
DEV_DIR="${ROOT_DIR}/tmp/dev-config" "${ROOT_DIR}/scripts/sync-production-config.sh"
fi
fi
@ -181,6 +181,10 @@ fi
printf "[hot-dev] Starting backend on port %s...\n" "${PULSE_DEV_API_PORT}"
cd "${ROOT_DIR}"
# Ensure dummy frontend file exists for go:embed
mkdir -p internal/api/frontend-modern/dist
touch internal/api/frontend-modern/dist/index.html
go build -o pulse ./cmd/pulse
# CRITICAL: Export all required environment variables for the backend
@ -192,7 +196,7 @@ export FRONTEND_PORT PULSE_DEV_API_PORT PORT
# Set data directory strategy for the backend
if [[ ${PULSE_MOCK_MODE:-false} == "true" ]]; then
export PULSE_DATA_DIR=/opt/pulse/tmp/mock-data
export PULSE_DATA_DIR="${ROOT_DIR}/tmp/mock-data"
mkdir -p "$PULSE_DATA_DIR"
echo "[hot-dev] Mock mode: Using isolated data directory: ${PULSE_DATA_DIR}"
else
@ -216,7 +220,7 @@ else
elif [[ ${PULSE_DATA_DIR} == "${ROOT_DIR}/tmp/dev-config" ]]; then
DEV_KEY_FILE="${PULSE_DATA_DIR}/.encryption.key"
if [[ ! -f "${DEV_KEY_FILE}" ]]; then
openssl rand -hex 32 > "${DEV_KEY_FILE}"
openssl rand -base64 32 > "${DEV_KEY_FILE}"
chmod 600 "${DEV_KEY_FILE}"
echo "[hot-dev] Generated dev encryption key at ${DEV_KEY_FILE}"
fi

View file

@ -5,7 +5,7 @@
set -euo pipefail
PROD_DIR="/etc/pulse"
DEV_DIR="/opt/pulse/tmp/dev-config"
DEV_DIR=${DEV_DIR:-"/opt/pulse/tmp/dev-config"}
# Ensure dev config directory exists
mkdir -p "$DEV_DIR"
@ -44,7 +44,7 @@ else
echo "⚠ Production encryption key not found. Using dev-only key."
if [ ! -f "$DEV_DIR/.encryption.key" ]; then
# Generate a dev-only encryption key so backend can start
openssl rand -hex 32 > "$DEV_DIR/.encryption.key"
openssl rand -base64 32 > "$DEV_DIR/.encryption.key"
chmod 600 "$DEV_DIR/.encryption.key"
echo "✓ Generated dev encryption key at $DEV_DIR/.encryption.key"
else