Created
March 11, 2021 17:12
-
-
Save jaddek/1858d3508d078f3bd71b3fce3dcffc6b to your computer and use it in GitHub Desktop.
Setup certs for docker app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment