Add --silent flag
This commit is contained in:
parent
220a1c2121
commit
8eb11e6524
1 changed files with 17 additions and 6 deletions
23
certman.sh
23
certman.sh
|
@ -3,7 +3,6 @@
|
||||||
# Exit on any error, treat unset variables as errors, and propagate errors in pipelines
|
# Exit on any error, treat unset variables as errors, and propagate errors in pipelines
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Load environment variables
|
|
||||||
if [ -f .env ]; then
|
if [ -f .env ]; then
|
||||||
source .env
|
source .env
|
||||||
else
|
else
|
||||||
|
@ -11,13 +10,24 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Color definitions
|
AUTO_MODE="false"
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
--silent)
|
||||||
|
AUTO_MODE="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
BLUE='\033[0;34m'
|
BLUE='\033[0;34m'
|
||||||
NC='\033[0m' # No Color
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
# Temporary directory for certs
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
trap 'rm -rf "$TEMP_DIR"' EXIT
|
trap 'rm -rf "$TEMP_DIR"' EXIT
|
||||||
|
|
||||||
|
@ -138,9 +148,10 @@ process_certificates() {
|
||||||
certs_array=$(echo "$CERTIFICATES" | jq -c '.[]')
|
certs_array=$(echo "$CERTIFICATES" | jq -c '.[]')
|
||||||
|
|
||||||
while IFS= read -r cert; do
|
while IFS= read -r cert; do
|
||||||
local domain=$(echo "$cert" | jq -r '.domain')
|
local domain cert_api_key key_api_key
|
||||||
local cert_api_key=$(echo "$cert" | jq -r '.cert_api_key')
|
domain=$(echo "$cert" | jq -r '.domain')
|
||||||
local key_api_key=$(echo "$cert" | jq -r '.key_api_key')
|
cert_api_key=$(echo "$cert" | jq -r '.cert_api_key')
|
||||||
|
key_api_key=$(echo "$cert" | jq -r '.key_api_key')
|
||||||
|
|
||||||
if download_and_verify_cert "$domain" "$cert_api_key" "$key_api_key"; then
|
if download_and_verify_cert "$domain" "$cert_api_key" "$key_api_key"; then
|
||||||
if install_certificate "$domain"; then
|
if install_certificate "$domain"; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue