Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(minikube): address prereqs review nits (export .env keys, RAM rounding, sourcing comment)

Andy Pavia0b39eb6a5c80
diff --git a/scripts/check-prereqs.sh b/scripts/check-prereqs.sh
index 0f4693a6c..ab29dd363 100755
--- a/scripts/check-prereqs.sh
+++ b/scripts/check-prereqs.sh
@@ -163,7 +163,10 @@ if command -v docker >/dev/null 2>&1; then
MEM_BYTES="$(docker info --format '{{.MemTotal}}' 2>/dev/null || echo 0)"
CPUS="$(docker info --format '{{.NCPU}}' 2>/dev/null || echo 0)"
if [ "${MEM_BYTES:-0}" -gt 0 ]; then
- MEM_GB=$((MEM_BYTES / 1024 / 1024 / 1024))
+ # Round to the nearest GB (+0.5 GB before the integer divide): docker's
+ # MemTotal sits a little below physical RAM, so a 10 GB allocation reports
+ # ~9.7 GB and would truncate to 9 → a spurious "wants >= 10 GB" warning.
+ MEM_GB=$(((MEM_BYTES + 512 * 1024 * 1024) / (1024 * 1024 * 1024)))
if [ "$MEM_GB" -lt 10 ]; then
warn "docker has ~${MEM_GB} GB RAM allocated (setup wants >= 10 GB — raise it in Docker Desktop → Settings → Resources)"
else
@@ -195,8 +198,9 @@ fi
# Parse the specific keys instead of sourcing .env (never execute it).
env_value() {
# Last non-comment assignment wins; strips surrounding quotes/whitespace.
+ # Tolerates an optional leading `export ` (a common .env habit).
local key="$1" file="$2" raw
- raw="$(grep -E "^[[:space:]]*${key}=" "$file" 2>/dev/null | tail -n1)" || return 0
+ raw="$(grep -E "^[[:space:]]*(export[[:space:]]+)?${key}=" "$file" 2>/dev/null | tail -n1)" || return 0
raw="${raw#*=}"
raw="${raw%\"}"; raw="${raw#\"}"
raw="${raw%\'}"; raw="${raw#\'}"
diff --git a/scripts/minikube/apply-llm-secret.sh b/scripts/minikube/apply-llm-secret.sh
index d43c383f6..213fd5fa6 100755
--- a/scripts/minikube/apply-llm-secret.sh
+++ b/scripts/minikube/apply-llm-secret.sh
@@ -51,6 +51,10 @@ if [ -z "$ENV_FILE" ]; then
if [ -z "$ENV_FILE" ] && [ -f .env ]; then ENV_FILE=".env"; fi
fi
if [ -n "$ENV_FILE" ] && [ -f "$ENV_FILE" ]; then
+ # Sourced by design (unlike check-prereqs.sh, which grep-parses .env): the
+ # per-provider `${!env_name}` indirect expansion below needs the real values
+ # in the environment. This mirrors the original inline Makefile behavior. A
+ # normal KEY=value .env is safe; a malformed line could abort under set -e.
set -a; . "$ENV_FILE"; set +a
fi