From ed009c0ec85080eff81458fe12f82e012ad08459 Mon Sep 17 00:00:00 2001 From: polarathene <5098581+polarathene@users.noreply.github.com> Date: Tue, 28 Sep 2021 20:48:41 +1300 Subject: [PATCH] chore: 4/6 - Extract grouped logic to their own methods --- docker-entrypoint.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 680fdf1..7b21e36 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -32,7 +32,7 @@ function _setup_dhparam() { fi } -function _init() { +function _check_unix_socket() { # Warn if the DOCKER_HOST socket does not exist if [[ $DOCKER_HOST = unix://* ]]; then socket_file=${DOCKER_HOST#unix://} @@ -46,9 +46,9 @@ function _init() { exit 1 fi fi +} - _setup_dhparam - +function _resolvers() { # Compute the DNS resolvers for use in the templates - if the IP contains ":", it's IPv6 and must be enclosed in [] RESOLVERS=$(awk '$1 == "nameserver" {print ($2 ~ ":")? "["$2"]": $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g'); export RESOLVERS @@ -66,7 +66,11 @@ function _init() { # Run the init logic if the default CMD was provided if [[ $* == 'forego start -r' ]]; then - _init + _check_unix_socket + + _resolvers + + _setup_dhparam fi exec "$@"