From 6b2168ff1111d5e9dd679c623b633ba2664ba268 Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Fri, 4 Nov 2022 13:09:11 +0100 Subject: [PATCH] Allow to read hostname from config file --- bridgehead | 1 + lib/functions.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bridgehead b/bridgehead index 68e8933..3054ebd 100755 --- a/bridgehead +++ b/bridgehead @@ -59,6 +59,7 @@ if [ -f "$PROJECT/docker-compose.override.yml" ]; then fi detectCompose +setHostname case "$ACTION" in start) diff --git a/lib/functions.sh b/lib/functions.sh index 6c81d7b..1ac7d60 100755 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -125,12 +125,17 @@ fail_and_report() { exit $1 } +setHostname() { + if [ -z "$HOST" ]; then + export HOST=$(hostname -f) + log DEBUG "Using auto-detected hostname $HOST." + fi +} + ##Setting Network properties # currently not needed #export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}'); -export HOST=$(hostname -f) - export PRODUCTION="false"; if [ "$(git branch --show-current)" == "main" ]; then export PRODUCTION="true";