infrastructure/roles/lego/files/lego.sh

26 lines
420 B
Bash
Executable file

#!/usr/bin/env sh
set -a
. ./service.env
set +a
domain="$1"
action="run"
exisiting_domains=$(docker compose run --rm app list -n)
if echo "$exisiting_domains" | grep -q "$domain";
then
action="renew"
fi
docker compose run --rm app \
--domains "$domain" \
"$action" \
"--$action-hook" "/config/hook.sh"
if [ "$?" = "33" ] && [ -x "./hooks/$domain" ];
then
echo "Running hook for $domain"
"./hooks/$domain"
fi