dehydrated-io / dehydrated

letsencrypt/acme client implemented as a shell-script – just add water
https://dehydrated.io
MIT License
5.96k stars 716 forks source link

Do I need to define all hook functions? #927

Closed adrian5 closed 9 months ago

adrian5 commented 9 months ago

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.

adrian5 commented 9 months ago

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

?

lukas2511 commented 9 months ago

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.