Do I need to define all hook functions? #616

Closed
opened 2025-12-29 01:27:52 +01:00 by adam · 2 comments
Owner

Originally created by @adrian5 on GitHub (Dec 9, 2023).

I noticed that having only a subset of functions makes dehydrated error out. Do I take the hook.sh example file as-is and only modify the function bodies I'm interested in, or what's the recommended approach?

I think I may only need deploy_cert() and deploy_ocsp() to do any actual work.

Originally created by @adrian5 on GitHub (Dec 9, 2023). I noticed that having only a subset of functions makes **dehydrated** error out. Do I take the [hook.sh](https://github.com/dehydrated-io/dehydrated/blob/master/docs/examples/hook.sh) example file as-is and only modify the function bodies I'm interested in, or what's the recommended approach? I think I may only need `deploy_cert()` and `deploy_ocsp()` to do any actual work.
adam closed this issue 2025-12-29 01:27:52 +01:00
Author
Owner

@adrian5 commented on GitHub (Dec 10, 2023):

It just dawned on me that the handler function at the bottom isn't binding. Do I assume correctly that this is fine:

deploy_cert() {}

deploy_ocsp() {}

HANDLER="$1"; shift
if [[ "${HANDLER}" =~ ^(deploy_cert|deploy_ocsp)$ ]]; then # Ignore all handler calls except the above
  "$HANDLER" "$@"
fi

?

@adrian5 commented on GitHub (Dec 10, 2023): It just dawned on me that the handler function at the bottom isn't binding. Do I assume correctly that this is fine: ```bash deploy_cert() { … } deploy_ocsp() { … } HANDLER="$1"; shift if [[ "${HANDLER}" =~ ^(deploy_cert|deploy_ocsp)$ ]]; then # Ignore all handler calls except the above "$HANDLER" "$@" fi ``` ?
Author
Owner

@lukas2511 commented on GitHub (Dec 11, 2023):

You only need to handle hook functions you really need. You can rewrite the hook script completely however you like it, it could also be written in another scripting language or even a compiled binary, the only thing that matters is that it can be run from the command line and accepts the hook function name as first parameter.

@lukas2511 commented on GitHub (Dec 11, 2023): You only need to handle hook functions you really need. You can rewrite the hook script completely however you like it, it could also be written in another scripting language or even a compiled binary, the only thing that matters is that it can be run from the command line and accepts the hook function name as first parameter.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dehydrated#616