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

Argument to get certalias in hook script #907

Closed RinkAttendant6 closed 1 year ago

RinkAttendant6 commented 1 year ago

In the docs there is an option to use certalias in domains.txt like this example.net example.org > certalias https://github.com/dehydrated-io/dehydrated/blob/v0.7.1/docs/examples/domains.txt#L13

It would be nice for the certalias value to be passed to the deploy_cert (and maybe unchanged_cert) hooks.

My current workaround works to some extent, but it will get the CERTDIR if there was no alias:

# bash
local CERTALIAS = basename "$(dirname "${3}")"
// JavaScript
const CERTALIAS = path.basename(path.dirname(process.argv[3]))

I suppose that I can mitigate this in my case by adding some kind of validation/lint script to ensure all entries in domains.txt have an alias.

In the bigger picture, I'm using the certalias values to determine where the files are supposed to be deployed to.

lukas2511 commented 1 year ago

There is an alias environment variable that should be accessible in the hook scripts. In cases where no alias is defined it's content will be the default name (first domain).