From d2058433431cc70b04f32427f53bb8657e290f67 Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Wed, 17 May 2023 18:37:13 -0400 Subject: [PATCH] Adding support for srv records --- uber-wrapper.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/uber-wrapper.sh b/uber-wrapper.sh index 00d353692..85ceb86ad 100644 --- a/uber-wrapper.sh +++ b/uber-wrapper.sh @@ -1,6 +1,18 @@ #!/bin/bash set -e +# SESSION_HOST and BROKER_HOST may point to SRV records that need to get resolved to a host/port +SESSION_REC=$(dig srv +noall +answer +short "$SESSION_HOST" | cut -d ' ' -f 3,4 | head -1) +BROKER_REC=$(dig srv +noall +answer +short "$BROKER_HOST" | cut -d ' ' -f 3,4 | head -1) +if [[ ! -z "$SESSION_REC" ]]; then + SESSION_HOST=$(echo $SESSION_REC | cut -d ' ' -f 2) + SESSION_PORT=$(echo $SESSION_REC | cut -d ' ' -f 1) +fi +if [[ ! -z "$BROKER_REC" ]]; then + BROKER_HOST=$(echo $BROKER_REC | cut -d ' ' -f 2) + BROKER_PORT=$(echo $BROKER_REC | cut -d ' ' -f 1) +fi + # This will replace any variable references in these files # If you want to add any additional settings here just add # the variables to the environment when running this.