#!/bin/bash

# Full localhost
curl -s           https://localhost.daplie.me:8443 >/dev/null
curl -s       https://www.localhost.daplie.me:8443 >/dev/null
curl -s       https://api.localhost.daplie.me:8443 >/dev/null
curl -s    https://assets.localhost.daplie.me:8443 >/dev/null
curl -s     https://cloud.localhost.daplie.me:8443 >/dev/null
curl -s https://api.cloud.localhost.daplie.me:8443 >/dev/null

curl -s https://admin.localhost.daplie.me:8443 >/dev/null
curl -s https://api.admin.localhost.daplie.me:8443 >/dev/null

curl -s https://localhost.admin.daplie.me:8443 >/dev/null
curl -s https://api.localhost.admin.daplie.me:8443 >/dev/null

# Full foo
curl -s           https://localhost.foo.daplie.me:8443 >/dev/null
curl -s       https://www.localhost.foo.daplie.me:8443 >/dev/null
curl -s       https://api.localhost.foo.daplie.me:8443 >/dev/null
curl -s    https://assets.localhost.foo.daplie.me:8443 >/dev/null
curl -s     https://cloud.localhost.foo.daplie.me:8443 >/dev/null
curl -s https://api.cloud.localhost.foo.daplie.me:8443 >/dev/null

curl -s https://localhost.bar.daplie.me:8443 >/dev/null
curl -s https://localhost.baz.daplie.me:8443 >/dev/null
curl -s https://api.localhost.foo.daplie.me:8443 >/dev/null
curl -s https://api.localhost.bar.daplie.me:8443 >/dev/null
curl -s https://api.localhost.baz.daplie.me:8443 >/dev/null

curl -s https://localhost.alpha.daplie.me:8443 >/dev/null
curl -s https://localhost.beta.daplie.me:8443 >/dev/null
curl -s https://localhost.gamma.daplie.me:8443 >/dev/null
curl -s https://api.localhost.alpha.daplie.me:8443 >/dev/null
curl -s https://api.localhost.beta.daplie.me:8443 >/dev/null
curl -s https://api.localhost.gamma.daplie.me:8443 >/dev/null

curl -s https://foo.localhost.daplie.me:8443 >/dev/null
curl -s https://bar.localhost.daplie.me:8443 >/dev/null
curl -s https://baz.localhost.daplie.me:8443 >/dev/null
curl -s https://api.foo.localhost.daplie.me:8443 >/dev/null
curl -s https://api.bar.localhost.daplie.me:8443 >/dev/null
curl -s https://api.baz.localhost.daplie.me:8443 >/dev/null

curl -s https://alpha.localhost.daplie.me:8443 >/dev/null
curl -s https://beta.localhost.daplie.me:8443 >/dev/null
curl -s https://gamma.localhost.daplie.me:8443 >/dev/null
curl -s https://api.alpha.localhost.daplie.me:8443 >/dev/null
curl -s https://api.beta.localhost.daplie.me:8443 >/dev/null
curl -s https://api.gamma.localhost.daplie.me:8443 >/dev/null

rsync -r ~/acme/etc/live/*localhost*daplie.me ./certs/

rm certs/*/*.bak

git status

git add certs/*localhost*/cert.pem
git add certs/*localhost*/fullchain.pem
git add certs/*localhost*/privkey.pem

git status
