#!/usr/bin/env bash CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" if ! command -v mkcert &>/dev/null; then echo "\033[41mUtil mkcert should be installed to configure the certificate\033[0m" echo "\033[31mYou can find it here: https://github.com/FiloSottile/mkcert\033[0m" exit fi check_mkcert while getopts h: flag; do case "${flag}" in h) hosts=$2 ;; esac done echo "Are you sure? The command would be is: mkcert ${hosts};" echo "\033[1;32mExample: mkcert example.com '*.example.org' myapp.dev localhost 127.0.0.1 ::1 \033[0m" echo "Continue? (y/n)" read sure if [ "${sure}" != 'y' ]; then exit fi DEST="${CURRENT_DIR}/../docker/container/nginx/certs/" # mkcert -install mkcert -cert-file "${DEST}devcert.pem" -key-file "${DEST}devcert-key.pem" "${hosts}"