Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/_helpers
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ function output_info {
output_tagged_string "$BG_B" "INFO" "$1"
}

function output_warning {
output_tagged_string "$BG_Y" "WARNING" "$1"
}

export BG_R
export BG_G
export BG_Y
Expand Down
21 changes: 21 additions & 0 deletions bin/proxy
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/usr/bin/env bash

# Enable auto-export
set -a

if [ -f ".env" ]; then
# shellcheck source=/dev/null
source ".env"
fi

# Disable auto-export
set +a

HOP_PATH=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
TOOLKIT_PATH=$(dirname "$HOP_PATH")

Expand Down Expand Up @@ -147,6 +158,16 @@ function pick_one_virtual_host_from_file() {

HOST_STRING=$(sed -nr 's/.*VIRTUAL_HOST=(.*)/\1/p' "$FILE")

# Trim double quotes from HOST_STRING
HOST_STRING=$(echo "$HOST_STRING" | tr -d '"')

# Pipe HOST_STRING through envsubst if available
if command -v envsubst &> /dev/null; then
HOST_STRING=$(echo "$HOST_STRING" | envsubst)
else
>&2 output_warning "envsubst not found. Skipping environment variable substitution."
fi

IFS="," read -ra HOSTS <<< "$HOST_STRING"

for HOST_ENTRY in "${HOSTS[@]}"; do
Expand Down