go-acme / lego

Let's Encrypt/ACME client and library written in Go
https://go-acme.github.io/lego/
MIT License
7.44k stars 985 forks source link

Support hook arguments #2184

Closed webcompas closed 1 month ago

webcompas commented 1 month ago

Welcome

How do you use lego?

Binary

Detailed Description

At the moment lego doesn't support hook commands with arguments. This can lead to a huge number of scripts (or other workarounds) despite they just differ by one little thing (for example a user or application id). If one could simply provide such information as an argument to the hook command this would make it much easier and reduce management efforts.

I would therefore very much welcome the support of arguments.

ldez commented 1 month ago

Hello,

lego already supports CLI arguments:

lego ... renew --renew-hook 'echo foo'

Note: quotes inside the hook command are not supported.

Do you have a concrete example?

webcompas commented 1 month ago

Note: quotes inside the hook command are not supported. Do you have a concrete example?

Thanks for this hint. I really tried to use a quoted string as argument. So the minimum solution would be to improve the documentation accordingly. Currently it doesn't mention arguments at all and even worse there's no warning about the unsupported quotes (see also #1468).

In addition there may be situations where a quoted string is needed (e.g. because of spaces or other special characters) or at least useful. So the better solution would be to support quotes and also improve the documentation accordingly.

ldez commented 1 month ago

I explained the situation here: https://github.com/go-acme/lego/issues/2168#issuecomment-2087707750

I agree that the documentation should be improved, so I flag your issue as a duplicate of #1468