Skip to content

Commit

Permalink
Bug fix for add function
Browse files Browse the repository at this point in the history
  • Loading branch information
richturner committed Apr 3, 2022
1 parent c7d9e0e commit 5fefe91
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ add() {
fi

DOMAINNAME="${1}"
DOMAIN_FOLDER="${LE_DIR}/live/{DOMAINNAME}"
RENEWED_LINEAGE="${LE_DIR}/live/${DOMAINNAME}"

# Basic invalid DOMAINNAME check
# Current ash shell on alpine needs regex to be quoted this isn't the case for newer bash shell versions hence the double check
Expand Down Expand Up @@ -159,11 +159,7 @@ add() {
return $ret
fi

# Concat the certificate chain and private key to a PEM file suitable for HAProxy
cat "${DOMAIN_FOLDER}/privkey.pem" \
"${DOMAIN_FOLDER}/fullchain.pem" \
> "/tmp/haproxy.pem"
mv "/tmp/haproxy.pem" "${CERT_DIR}/${DOMAINNAME}"
sync_haproxy

ret=$?

Expand Down Expand Up @@ -199,7 +195,7 @@ renew() {
fi
done

eval "$LE_CMD --force-renewal --expand $DOMAIN_ARGS"
eval "$LE_CMD --force-renewal --deploy-hook \"/entrypoint.sh sync-haproxy\" --expand $DOMAIN_ARGS"

LE_RESULT=$?

Expand All @@ -208,19 +204,6 @@ renew() {
return ${LE_RESULT}
fi

# Concat the certificate chain and private key to a PEM file suitable for HAProxy
cat "${DOMAIN_FOLDER}/privkey.pem" \
"${DOMAIN_FOLDER}/fullchain.pem" \
> "/tmp/haproxy.pem"
mv "/tmp/haproxy.pem" "${CERT_DIR}/${DOMAINNAME}"

ret=$?

if [ $ret -ne 0 ]; then
>&2 log_error "failed to create haproxy.pem file!"
return $ret
fi

log_info "Renewed domain \"${DOMAINNAME}\"..."
}

Expand Down

0 comments on commit 5fefe91

Please sign in to comment.