diff --git a/config-parser.sh b/config-parser.sh index 8068fae..7a8e548 100644 --- a/config-parser.sh +++ b/config-parser.sh @@ -36,6 +36,11 @@ parse_toml() { # Parse section headers [section] if [[ "$line" =~ ^[[:space:]]*\[([^\]]+)\][[:space:]]*$ ]]; then current_section="${BASH_REMATCH[1]}" + # Only increment stack_count for non-global sections + if [[ "$current_section" != "global" ]]; then + stack_count=$((stack_count + 1)) + STACK_NAMES[$stack_count]="$current_section" + fi continue fi @@ -60,9 +65,7 @@ parse_toml() { # Global settings export "${key^^}"="$value" else - # Stack configurations - stack_count=$((stack_count + 1)) - STACK_NAMES[$stack_count]="$current_section" + # Stack configurations - use current stack_count export "STACK_${stack_count}_${key^^}"="$value" fi fi