Allow working with LetsEncrypt Pebble and custom base URI #66
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 pull-request contains minimal code to allow setting custom base URL for a custom directory. That should help testing locally with Pebble and also possibly use with other ACME servers like @zerossl (https://zerossl.com/documentation/acme/).
It now accepts an option
baseUri
as part of the client initialization, which will override any default URL from LetsEncrypt. That should point to an ACME directory resource. One minor fix had to be made to properly fetch the directory URL pointed by the client, instead of a hardcoded/directory
one.One extra detail was that getting the certificate from Pebble required to first trigger the finalize URL to then poll the order for a certificate. I tried to mimic as much as possible the polling code from validate method.
Last but not less, instead of trying to work only with order ID, guessing the base URL, the code had to preserve and reuse the order URL. That's because the order URL from Pebble has not the same prefix than the new-order URL.