From 70da5dd087989d2779180402ae634ab165ce4cc6 Mon Sep 17 00:00:00 2001 From: Nathan Bishop Date: Fri, 28 Apr 2023 06:45:28 +1000 Subject: [PATCH 1/2] Replace tabs in example yaml code with spaces --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 284a195..ee5fb99 100644 --- a/README.md +++ b/README.md @@ -103,22 +103,22 @@ Currently, the image has not been setup to allow the certificate manager to be u ```yaml services: apache: - ... - labels: - sh.acme.domains: example.com,www.example.com - sh.acme.reload_command: docker compose restart apache + ... + labels: + sh.acme.domains: example.com,www.example.com + sh.acme.reload_command: docker compose restart apache mariadb: - ... - labels: - sh.acme.domains: db.example.com - sh.acme.reload_command: docker compose restart mariadb + ... + labels: + sh.acme.domains: db.example.com + sh.acme.reload_command: docker compose restart mariadb acme-certificate-manager: - ... - depends_on: - - apache - - mariadb + ... + depends_on: + - apache + - mariadb ``` ## CLI From c4c7cceb3b6ef5cc15870df8195b53278ebf641e Mon Sep 17 00:00:00 2001 From: Nathan Bishop Date: Sat, 29 Apr 2023 09:57:24 +1000 Subject: [PATCH 2/2] Implement the '-q' and '--quiet' options --- rootfs/certificate-manager.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rootfs/certificate-manager.sh b/rootfs/certificate-manager.sh index 0321b3b..d1a65f1 100644 --- a/rootfs/certificate-manager.sh +++ b/rootfs/certificate-manager.sh @@ -36,6 +36,9 @@ DEPLOY_DOCKER_LABEL=${DEPLOY_DOCKER_LABEL:-"sh.acme.deploy"} DEFAULT_CONTAINER_CERTIFICATE_STORE=${DEFAULT_CONTAINER_CERTIFICATE_STORE:-"/certs"} DEFAULT_CERTIFICATE_DEPLOYMENT=${DEFAULT_CERTIFICATE_DEPLOYMENT:-"crt,key"} +silence_output=false +verbose=false + # Return status codes: # 0: certificate is valid and up to date # 1: certificate has expired @@ -576,7 +579,7 @@ help() { echo " --version Show the version of the certificate manager" fi echo " -h, --help Show this help message" - echo " -q, --quite Disable all output" + echo " -q, --quiet Disable all output" echo " -v, --verbose Enable verbose output" echo "" @@ -625,6 +628,9 @@ while [ $# -gt 0 ]; do help "$action" exit 0 ;; + -q|--quiet) + silence_output=true + ;; *) # ignore any other options as they are passed directly to the action to handle ;; @@ -632,6 +638,11 @@ while [ $# -gt 0 ]; do shift done +# @todo: this should be done in a better way (maybe logfile) +if [ "$silence_output" == true ]; then + exec > /dev/null 2>&1 +fi + # set default CA server acme.sh --set-default-ca --server "$ACME_CA" --uninstall-cronjob >/dev/null 2>&1