You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

  1. #!/bin/bash
  2. ## Load action gets a first argument a DIRECTORY holding the necessary files.
  3. ##
  4. ##
  5. if [ -z "$SERVICE_DATASTORE" ]; then
  6. echo "This script is meant to be run through 'compose' to work properly." >&2
  7. exit 1
  8. fi
  9. usage="$exname [-h|--help] DOMAIN [DOMAIN...]"
  10. domains=()
  11. while [ "$1" ]; do
  12. case "$1" in
  13. "--help"|"-h")
  14. print_usage
  15. exit 0
  16. ;;
  17. --*|-*)
  18. err "Unexpected optional argument '$1'"
  19. print_usage
  20. exit 1
  21. ;;
  22. *)
  23. domains+=("$1")
  24. ;;
  25. esac
  26. shift
  27. done
  28. if [ -z "${domains[*]}" ]; then
  29. err "You must provide at least one domain as positional argument."
  30. print_usage
  31. exit 1
  32. fi
  33. set -e
  34. ## XXXvlab: should check that domain can be declared (with whois, check that the
  35. ## registrar is a provider that have config values declared in compose.conf)
  36. mkdir -p "$SERVICE_DATASTORE/etc/letsencrypt"
  37. echo "${domains[@]}" >> "$SERVICE_DATASTORE/etc/letsencrypt/domains.conf"
  38. info "Added '${domains[*]}' domains to letsencrypt domain lists."