Allow multiple hostnames for a container.

This commit is contained in:
Kevin Baensch 2023-01-18 15:02:13 +01:00
parent 01eee56fb7
commit 18caa2025b
2 changed files with 7 additions and 6 deletions

View file

@ -11,10 +11,15 @@ OUT='/config/Caddyfile'
label_hook() {
LOCAL_WEB_PORT="${LOCAL_WEB_PORT:-80}"
# Check if host contains spaces
if [[ "${LOCAL_WEB_HOST}" =~ \ ]]
then
LOCAL_WEB_HOST="$(sed 's/ /, /g' <<< ${LOCAL_WEB_HOST})"
fi
}
template_hook() {
if grep -q '^[^ ]\+ {\\n\\treverse_proxy \(?::\|[.0-9a-e]\)\+\:[0-9]\+\\n}$' <<< "${PARTIAL_RESULT}"
if [[ "${PARTIAL_RESULT}" =~ ^([^\{,\ ]+(,\ )?)+\ \{$'\\n\\t'reverse_proxy\ (::|[.0-9a-e]+)+\:[0-9]+$'\\n'\}$ ]]
then
return 0;
fi

View file

@ -8,10 +8,6 @@ if [ -f "${HOST_CONF_PATH}" ]
then
WRAP_START=$(grep -ve "# Added by hostman$" "${HOST_CONF_PATH}")
WRAP_START+="\n"
else
printf "[WARN]: No such file or directory: %s\n" "${HOST_CONF_PATH}"
printf "Creating %s" "${HOST_CONF_PATH}"
touch "${HOST_CONF_PATH}"
fi
if ! $RESOLVE_DOCKERHOST
@ -32,7 +28,7 @@ else
fi
template_hook() {
if grep -q '^[:.0-9a-e]\+ [^ ]\+ # Added by hostman$' <<< "${PARTIAL_RESULT}"
if [[ "${PARTIAL_RESULT}" =~ ^(::|[.0-9a-e]+)+\ ([^ ]+\ )+\#\ Added\ by\ hostman$ ]]
then
return 0;
fi