mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 09:48:14 +00:00
chore: 2/6 - Handle CMD check early, wrap init logic into a function
This commit is contained in:
parent
8aacd13241
commit
2e6d7561a3
@ -32,6 +32,7 @@ function _setup_dhparam() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _init() {
|
||||||
# Warn if the DOCKER_HOST socket does not exist
|
# Warn if the DOCKER_HOST socket does not exist
|
||||||
if [[ $DOCKER_HOST = unix://* ]]; then
|
if [[ $DOCKER_HOST = unix://* ]]; then
|
||||||
socket_file=${DOCKER_HOST#unix://}
|
socket_file=${DOCKER_HOST#unix://}
|
||||||
@ -42,10 +43,8 @@ if [[ $DOCKER_HOST = unix://* ]]; then
|
|||||||
See the documentation at http://git.io/vZaGJ
|
See the documentation at http://git.io/vZaGJ
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
# If the user has run the default command and the socket doesn't exist, fail
|
exit 1
|
||||||
if [ "$1" = forego ] && [ "$2" = start ] && [ "$3" = '-r' ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -64,5 +63,11 @@ elif [[ $RESOLVERS =~ $SCOPED_IPV6_REGEX ]]; then
|
|||||||
echo "$RESOLVERS" | grep -Eo "$SCOPED_IPV6_REGEX" | paste -s -d ' ' >&2
|
echo "$RESOLVERS" | grep -Eo "$SCOPED_IPV6_REGEX" | paste -s -d ' ' >&2
|
||||||
RESOLVERS=$(echo "$RESOLVERS" | sed -r "s/$SCOPED_IPV6_REGEX//g" | xargs echo -n); export RESOLVERS
|
RESOLVERS=$(echo "$RESOLVERS" | sed -r "s/$SCOPED_IPV6_REGEX//g" | xargs echo -n); export RESOLVERS
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the init logic if the default CMD was provided
|
||||||
|
if [[ $* == 'forego start -r' ]]; then
|
||||||
|
_init
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user