feat(roles/lego): Add support for LEGO_HTTP_PORT_FALLBACK #5
@ -2,9 +2,18 @@
|
|||||||
|
|
||||||
LEGO_BINARY=$(/usr/bin/env which lego)
|
LEGO_BINARY=$(/usr/bin/env which lego)
|
||||||
|
|
||||||
|
if [[ -n "$LEGO_HTTP_FALLBACK_PORT" ]]; then
|
||||||
jadyn marked this conversation as resolved
Outdated
|
|||||||
|
nc -z 127.0.0.1 $LEGO_HTTP_PORT;
|
||||||
transcaffeine
commented
Where is $LEGO_HTTP_FALLBACK_PORT coming from? possibly missing documentation... Where is $LEGO_HTTP_FALLBACK_PORT coming from? possibly missing documentation...
|
|||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
transcaffeine
commented
specify specify `-w` to avoid waiting for up to 30s. Also consider lego binds to `0.0.0.0`, and a webserver might be bound only to an external IP (which would be not detected properly)
jadyn
commented
As the debian/stable version doesn't support IPv6 (yet?) and other options utilizing pre-installed tools require root access, this could be fixed by using a more complex approach or installing additional software. Otherwise I'd suggest looping over all configured (external IPs) using As the debian/stable version doesn't support IPv6 (yet?) and other options utilizing pre-installed tools require root access, this could be fixed by using a more complex approach or installing additional software. Otherwise I'd suggest looping over all configured (external IPs) using `$(hostname --all-ip-addresses)`.
|
|||||||
|
LEGO_HTTP_PORT=$LEGO_HTTP_FALLBACK_PORT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
LEGO_COMMAND_ARGS_EXPANDED=$(bash -c "echo $LEGO_COMMAND_ARGS") # This is a bit icky
|
||||||
|
|
||||||
jadyn marked this conversation as resolved
Outdated
transcaffeine
commented
Remove debug statement Remove debug statement
|
|||||||
FILES_IN_DIR=$(find "$LEGO_CERT_STORE_PATH/certificates" | wc -l)
|
FILES_IN_DIR=$(find "$LEGO_CERT_STORE_PATH/certificates" | wc -l)
|
||||||
if [[ $FILES_IN_DIR -gt 2 ]]; then
|
if [[ $FILES_IN_DIR -gt 2 ]]; then
|
||||||
$LEGO_BINARY $LEGO_COMMAND_ARGS renew --days=$LEGO_CERT_DAYS_TO_RENEW
|
$LEGO_BINARY $LEGO_COMMAND_ARGS_EXPANDED renew --days=$LEGO_CERT_DAYS_TO_RENEW
|
||||||
else
|
else
|
||||||
$LEGO_BINARY $LEGO_COMMAND_ARGS run
|
$LEGO_BINARY $LEGO_COMMAND_ARGS_EXPANDED run
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue
Block a user
Move L5 directly to before its corresponding if-statement