mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-01-11 22:30:44 +01:00
adding certalias to deploy_cert ? #344
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gytisgreitai on GitHub (May 3, 2018).
Right now the deploy_cert receives domain name, key, cert, fullchain path and date but not the alias (e.g. for wildcard certs)
Since
aliasvariable is already exported, the change would be as simple as adding it to the end of command, and would not break any existing implementations:[[ -n "${HOOK}" ]] && "${HOOK}" "deploy_cert" "${domain}" "${certdir}/privkey.pem" "${certdir}/cert.pem" "${certdir}/fullchain.pem" "${certdir}/chain.pem" "${timestamp}" "${alias}"@jobe1986 commented on GitHub (May 3, 2018):
You can also use a combination of the dirname and basename commands to extract the alias name from the key, cert, fullchain or chain paths.
I found this out when I considered making a similar request for the $certdir path to be added to the same hook but found I could work them out myself.
@lukas2511 commented on GitHub (May 3, 2018):
Like @jobe1986 said you can already extract that from the path and you could also just use the environment variable as it's exported.
@lcts commented on GitHub (Jan 18, 2019):
For others who stumble on this issue:
If, like me, you prefer to extract the alias from the parameters passed to the hook, here's one simple way to get it from e.g. the keyfile (parameter $2):
(strip everything up to the first / from end of string (path), then strip everything up to the last / from beginning)
It doesn't matter what name you give
_TMP, and if you're using the hook.sh template you can replace${2%/*}with${KEYFILE%/*}for better readability.If your hook is executed in zsh instead of bash, this works: