mirror of
https://github.com/smittix/intercept.git
synced 2026-06-21 19:51:05 -07:00
v2.26.4: fix Environment Configurator crash when .env variable missing (#191)
read_env_var() grep pipeline failed under set -euo pipefail when .env existed but didn't contain the requested key. grep returned 1 (no match), pipefail propagated it, and set -e killed the script. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -174,7 +174,7 @@ read_env_var() {
|
||||
local fallback="${2:-}"
|
||||
if [[ -f "$SCRIPT_DIR/.env" ]]; then
|
||||
local val
|
||||
val=$(grep -E "^${key}=" "$SCRIPT_DIR/.env" 2>/dev/null | tail -1 | cut -d'=' -f2-)
|
||||
val=$(grep -E "^${key}=" "$SCRIPT_DIR/.env" 2>/dev/null | tail -1 | cut -d'=' -f2- || true)
|
||||
if [[ -n "$val" ]]; then
|
||||
# Strip surrounding quotes
|
||||
val="${val#\"}"
|
||||
|
||||
Reference in New Issue
Block a user