|
|
@ -14,6 +14,7 @@ |
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
service_def=$(get_compose_service_def "$SERVICE_NAME") |
|
|
|
|
|
|
|
USER_EMAIL=$(echo "$service_def" | shyaml get-value options.email 2>/dev/null) || { |
|
|
@ -47,12 +48,31 @@ if environment_def="$(printf "%s" "$service_def" | shyaml -y get-value options.e |
|
|
|
config+=$(echo -en "\n LEXICON_PROVIDER: $provider") |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! challenge_type=$(printf "%s" "$service_def" | shyaml get-value "options.challenge-type" 2>/dev/null); then |
|
|
|
warn "No ${WHITE}challenge-type${NORMAL} provided, defaulting to 'http'." |
|
|
|
challenge_type=http |
|
|
|
fi |
|
|
|
config+=$(echo -en "\n CHALLENGE_TYPE: $challenge_type") |
|
|
|
|
|
|
|
|
|
|
|
aimport remainder_args |
|
|
|
if [ "$challenge_type" == "http" ] && |
|
|
|
[ "${remainder_args[0]}" == "crt" ] && |
|
|
|
[ "${remainder_args[1]}" == "create" ] && |
|
|
|
! [ -d "$SERVICE_DATASTORE/etc/letsencrypt/live/${remainder_args[2]}" ]; then |
|
|
|
while read container_id; do |
|
|
|
docker stop -t 5 "$container_id" |
|
|
|
done < <(docker ps \ |
|
|
|
--filter label="compose.project=$PROJECT_NAME" \ |
|
|
|
--filter publish=80 \ |
|
|
|
--format "{{.ID}}" |
|
|
|
) |
|
|
|
config+=$(echo -en "\n ports: |
|
|
|
- \"0.0.0.0:80:80\"") |
|
|
|
fi |
|
|
|
|
|
|
|
init-config-add "$config" |
|
|
|
|
|
|
|
mkdir -p "$SERVICE_DATASTORE/etc/letsencrypt" |