File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ function output_info {
9494 output_tagged_string " $BG_B " " INFO" " $1 "
9595}
9696
97+ function output_warning {
98+ output_tagged_string " $BG_Y " " WARNING" " $1 "
99+ }
100+
97101export BG_R
98102export BG_G
99103export BG_Y
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # Enable auto-export
4+ set -a
5+
6+ if [ -f " .env" ]; then
7+ # shellcheck source=/dev/null
8+ source " .env"
9+ fi
10+
11+ # Disable auto-export
12+ set +a
13+
314HOP_PATH=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
415TOOLKIT_PATH=$( dirname " $HOP_PATH " )
516
@@ -147,6 +158,16 @@ function pick_one_virtual_host_from_file() {
147158
148159 HOST_STRING=$( sed -nr ' s/.*VIRTUAL_HOST=(.*)/\1/p' " $FILE " )
149160
161+ # Trim double quotes from HOST_STRING
162+ HOST_STRING=$( echo " $HOST_STRING " | tr -d ' "' )
163+
164+ # Pipe HOST_STRING through envsubst if available
165+ if command -v envsubst & > /dev/null; then
166+ HOST_STRING=$( echo " $HOST_STRING " | envsubst)
167+ else
168+ >&2 output_warning " envsubst not found. Skipping environment variable substitution."
169+ fi
170+
150171 IFS=" ," read -ra HOSTS <<< " $HOST_STRING"
151172
152173 for HOST_ENTRY in " ${HOSTS[@]} " ; do
You can’t perform that action at this time.
0 commit comments