#!/bin/bash ## Load action gets a first argument a DIRECTORY holding the necessary files. ## ## if [ -z "$SERVICE_DATASTORE" ]; then echo "This script is meant to be run through 'compose' to work properly." >&2 exit 1 fi usage="$exname [-h|--help] DOMAIN [DOMAIN...]" domains=() while [ "$1" ]; do case "$1" in "--help"|"-h") print_usage exit 0 ;; --*|-*) err "Unexpected optional argument '$1'" print_usage exit 1 ;; *) domains+=("$1") ;; esac shift done if [ -z "${domains[*]}" ]; then err "You must provide at least one domain as positional argument." print_usage exit 1 fi set -e ## XXXvlab: should check that domain can be declared (with whois, check that the ## registrar is a provider that have config values declared in compose.conf) mkdir -p "$SERVICE_DATASTORE/etc/letsencrypt" echo "${domains[@]}" >> "$SERVICE_DATASTORE/etc/letsencrypt/domains.conf" info "Added '${domains[*]}' domains to letsencrypt domain lists."