2
0

setup-domain 596 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. [ -z "$1" ] && echo "Please specify a domain name (ex. magento.test)" && exit
  4. DOMAIN=$1
  5. if ! grep -q "$DOMAIN" /etc/hosts; then
  6. echo "Your system password is needed to add an entry to /etc/hosts..."
  7. echo "127.0.0.1 ::1 $DOMAIN" | sudo tee -a /etc/hosts
  8. fi
  9. echo "Set https://${DOMAIN}/ to web/secure/base_url and web/unsecure/base_url"
  10. bin/clinotty bin/magento config:set web/secure/base_url https://"$DOMAIN"/
  11. bin/clinotty bin/magento config:set web/unsecure/base_url https://"$DOMAIN"/
  12. echo "Generating SSL certificate..."
  13. bin/setup-ssl "$DOMAIN"