I’d love to have a cli option like --hook-env X=Y
(can be used multiple times with different X).
How it works: X
with value Y
is added to the hook’s environment during call.
I see python’s subprocess.Popen()
used by execute()
in certbot/certbot/hooks.py
allows using a custom environment like shown here https://stackoverflow.com/a/4453495/1908161
How can we benefit from this feature: this way we can put config variables for hooks into cli.ini
(so it is a single config for all certbot stuff) in a nice and clean way like
renew-hook = /var/apps/deploy.sh
hook-env = MY_EMAIL=kaka@shino.bu
while keeping logging logic intact: this line https://github.com/certbot/certbot/blob/a67a917eca25b26f41c6849f45856239196ea48c/certbot/hooks.py#L243 woks incorrectly in case I use a dirty cli.ini
hack like
renew-hook = MY_EMAIL=kaka@shino.bu /var/apps/deploy.sh # Quoting required mby?
disable-hook-validation = True