1
0

Refactor btcpay up, down and restart in helpers.sh

This commit is contained in:
nicolas.dorier
2019-06-12 12:23:58 +09:00
parent 1c3f7fc641
commit 5ad1d3c5b6
7 changed files with 52 additions and 26 deletions

View File

@@ -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
}