Add createHandler
method for programmatic configuration
#63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposes the addition of a new public method,
createHandler
. The main use-case for this is to allow the user to inject their own configuration without having to rely on environment variables.In my particular case, I am storing my secrets in AWS Parameter Store as SecretStrings, as I prefer to not to have to manually do KMS encryption and maintain (and pay for) yet another KMS key, and I don't want to keep my webhook url unencrypted as I'm using this in an open source project where anyone can see the build logs.
Example would be something like this for my case:
Considered alternatives
I considered writing to
process.env['UNENCRYPTED_HOOK_URL']
after looking up the decrypted value, but sinceconfig.js
is imported immediately, the value will have already been read from the environment before I can look it up.Note
Since this project doesn't have a test suite, I'm not 100% sure that my code actually works. I haven't had a chance to manually test it yet, as it requires quite a lot of setup. If this PR would be considered to be merged, it will first have to actually be tested.