#!/usr/bin/env bash

# Loads server/.env with the Node dotenv package and exports a safe whitelist
# of variables for shell scripts. This handles special characters in values.

load_server_env() {
  local root_dir="$1"
  local env_file="$root_dir/server/.env"

  if [ ! -f "$env_file" ]; then
    return 0
  fi

  eval "$(ROOT_DIR="$root_dir" node "$root_dir/server/load-env.mjs")"
}
