1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 09:48:14 +00:00

chore: 4/6 - Extract grouped logic to their own methods

This commit is contained in:
polarathene 2021-09-28 20:48:41 +13:00
parent 091dd855af
commit ed009c0ec8

View File

@ -32,7 +32,7 @@ function _setup_dhparam() {
fi fi
} }
function _init() { function _check_unix_socket() {
# 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://}
@ -46,9 +46,9 @@ function _init() {
exit 1 exit 1
fi fi
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 [] # 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 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 # Run the init logic if the default CMD was provided
if [[ $* == 'forego start -r' ]]; then if [[ $* == 'forego start -r' ]]; then
_init _check_unix_socket
_resolvers
_setup_dhparam
fi fi
exec "$@" exec "$@"