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 alias variable is already exported, the change would be as simple as adding it to the end of command, and would not break any existing implementations:
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 `alias` variable 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}"`
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.
@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.
Like @jobe1986 said you can already extract that from the path and you could also just use the environment variable as it's exported.
@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.
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):
certalias=$(_TMP=${2%/*};echo ${_TMP##*/})
(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:
certalias=${${2%/*}##*/}
@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):
```
certalias=$(_TMP=${2%/*};echo ${_TMP##*/})
```
(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:
```
certalias=${${2%/*}##*/}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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: