teamhanko / hanko

Authentication and user management for the passkey era.
https://hanko.io
Other
5.67k stars 794 forks source link

feat: add webhook env var decoder #1515

Closed lfleischmann closed 1 month ago

lfleischmann commented 1 month ago

Description

The webhook.hooks config option is an array of objects. When using environment variables, specifying the hooks such that the envconfig package can correctly map the values into the config struct does not seem to be possible with the built-in capabilities.

Implementation

envconfig allows defining custom decoders, though. This PR introduces an implementation so that hooks can be defined via environment variables as follows:

WEBHOOKS_HOOKS={"callback":"http://app.com/usercb","events":["user"]};{"callback":"http://app.com/emailcb","events":["email.send"]}