From e763e9e41a946f876bfe8a9ef301e1dd226ffa1b Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 21 Sep 2019 23:06:15 +0900 Subject: [PATCH] Make sure BTCPAY_SSHKEYFILE is set when starting container --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1b4686e4f..dfb090c14 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,7 +2,7 @@ echo "$(/sbin/ip route|awk '/default/ { print $3 }') host.docker.internal" >> /etc/hosts -if ! [ -f "$BTCPAY_SSHKEYFILE" ]; then +if [[ "$BTCPAY_SSHKEYFILE" ]] && ! [ -f "$BTCPAY_SSHKEYFILE" ]; then echo "Creating BTCPay Server SSH key File..." ssh-keygen -t rsa -f "$BTCPAY_SSHKEYFILE" -q -P "" -m PEM -C btcpayserver > /dev/null if [ -f "$BTCPAY_SSHAUTHORIZEDKEYS" ]; then @@ -13,7 +13,7 @@ if ! [ -f "$BTCPAY_SSHKEYFILE" ]; then fi fi -if [ -f "$BTCPAY_SSHAUTHORIZEDKEYS" ] && ! grep -q "btcpayserver$" "$BTCPAY_SSHAUTHORIZEDKEYS"; then +if [[ "$BTCPAY_SSHKEYFILE" ]] && [ -f "$BTCPAY_SSHAUTHORIZEDKEYS" ] && ! grep -q "btcpayserver$" "$BTCPAY_SSHAUTHORIZEDKEYS"; then echo "Adding BTCPay Server SSH key to authorized keys" cat "$BTCPAY_SSHKEYFILE.pub" >> "$BTCPAY_SSHAUTHORIZEDKEYS" fi