Refactor btcpay up, down and restart in helpers.sh
This commit is contained in:
33
helpers.sh
33
helpers.sh
@@ -82,4 +82,37 @@ LIBREPATRON_HOST=$LIBREPATRON_HOST
|
||||
BTCTRANSMUTER_HOST=$BTCTRANSMUTER_HOST
|
||||
BTCPAY_CRYPTOS=$BTCPAY_CRYPTOS
|
||||
WOOCOMMERCE_HOST=$WOOCOMMERCE_HOST" > $BTCPAY_ENV_FILE
|
||||
}
|
||||
|
||||
btcpay_up() {
|
||||
pushd
|
||||
cd "$(dirname "$BTCPAY_ENV_FILE")"
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE up --remove-orphans -d -t "${COMPOSE_HTTP_TIMEOUT:-180}"
|
||||
# Depending on docker-compose, either the timeout does not work, or "compose -d and --timeout cannot be combined"
|
||||
if ! [ $? -eq 0 ]; then
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE up --remove-orphans -d
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
btcpay_down() {
|
||||
pushd
|
||||
cd "$(dirname "$BTCPAY_ENV_FILE")"
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE down -t "${COMPOSE_HTTP_TIMEOUT:-180}"
|
||||
# Depending on docker-compose, the timeout does not work.
|
||||
if ! [ $? -eq 0 ]; then
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE down
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
btcpay_restart() {
|
||||
pushd
|
||||
cd "$(dirname "$BTCPAY_ENV_FILE")"
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE restart -t "${COMPOSE_HTTP_TIMEOUT:-180}"
|
||||
# Depending on docker-compose, the timeout does not work.
|
||||
if ! [ $? -eq 0 ]; then
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE restart
|
||||
fi
|
||||
popd
|
||||
}
|
||||
Reference in New Issue
Block a user