Skip to content

Commit

Permalink
Merge pull request #2 from nbish11/feat-implement-quiet-option
Browse files Browse the repository at this point in the history
Feat implement quiet option
  • Loading branch information
nbish11 authored Apr 29, 2023
2 parents f72e50d + c4c7cce commit 507eaca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion rootfs/certificate-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -625,13 +628,21 @@ 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
;;
esac
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

Expand Down

0 comments on commit 507eaca

Please sign in to comment.