echo 'Removing old certificates'
cd /certs
mv /certs/*.crt /certs/old/
mv /certs/*.key /certs/old/
mv /certs/*.pem /certs/old/
echo 'Downloading new certificates'
wget http://home.lungu.net/bp/private.key
wget http://home.lungu.net/bp/ca_bundle.crt
wget http://home.lungu.net/bp/certificate.crt
echo 'Converting certificates'
openssl x509 -in certificate.crt -out fullchain.pem -outform PEM
cat certificate.crt private.key > privkey.pem
echo 'Removing expired certificates'
mv /binance-to-google-sheets-proxy/priv/ssl/*.pem /binance-to-google-sheets-proxy/priv/ssl/old/
echo 'Copying new certificates'
cp /certs/privkey.pem /binance-to-google-sheets-proxy/priv/ssl/
cp /certs/fullchain.pem /binance-to-google-sheets-proxy/priv/ssl/
echo 'All done!'
