mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-28 05:34:19 +00:00
Fix tilde expansion for .env paths in manage.sh (#318)
## Summary - fix safe .env parser in manage.sh to expand a leading ~ before export - ensure setup-time PROD_DATA_DIR read from .env also expands ~ - keep behavior unchanged for non-tilde values ## Why xport "=" does not perform tilde expansion, so values like PROD_DATA_DIR=~/meshcore-data stayed literal and broke path-based operations in manage.sh. ## Validation - ash -n manage.sh - manual reasoning: PROD_DATA_DIR=~/meshcore-data now resolves to $HOME/meshcore-data ## Notes Docker Compose handling is unchanged (compose already expands ~); this PR only fixes manage.sh runtime parsing. Co-authored-by: Kpa-clawbot <259247574+Kpa-clawbot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Kpa-clawbot
Copilot
parent
6922d63b1c
commit
a2c9211dac
@@ -21,6 +21,7 @@ if [ -f .env ]; then
|
||||
key=$(printf '%s' "$key" | sed 's/\r$//' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')
|
||||
[[ "$key" =~ ^#.*$ || -z "$key" ]] && continue
|
||||
value=$(printf '%s' "$value" | sed 's/\r$//' | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')
|
||||
value="${value/#\~/$HOME}"
|
||||
export "$key=$value"
|
||||
done < .env
|
||||
set +a
|
||||
@@ -580,6 +581,7 @@ cmd_setup() {
|
||||
env_mqtt=$(get_env_value "PROD_MQTT_PORT" ".env")
|
||||
env_disable_mosquitto=$(get_env_value "DISABLE_MOSQUITTO" ".env")
|
||||
env_data_dir=$(get_env_value "PROD_DATA_DIR" ".env")
|
||||
env_data_dir="${env_data_dir/#\~/$HOME}"
|
||||
[ -n "$env_data_dir" ] && selected_data_dir="$env_data_dir"
|
||||
[ -n "$env_disable_mosquitto" ] && selected_disable_mosquitto="$env_disable_mosquitto"
|
||||
show_env_port_summary "${env_http:-<unset>}" "${env_https:-<unset>}" "${env_mqtt:-<unset>}" "${env_data_dir:-<unset>}" "${env_disable_mosquitto:-<unset>}"
|
||||
|
||||
Reference in New Issue
Block a user