jbostoen / itop-jb-report-generator

https://jeffreybostoen.be
2 stars 2 forks source link

Feature: use proxy service to render PDF #6

Closed jbostoen closed 2 years ago

jbostoen commented 2 years ago

Already implemented with https://github.com/jbostoen/itop-jb-report-generator/commit/526bc4822c13b06021490e8b88c247b19ee24eb5

Documenting the use case: lots of iTop users rely on a typical webhost where they only have access to a PHP server and database, but where they can not install the necessary dependencies to generate PDFs using Spatie's BrowserShot.

This commit introduces a pdf_renderer setting, which defaults to browsershot (as previously implemented); but it can also be set to external, in which case the output of the report is base64 encoded and sent to the proxy service URL configured in pdf_renderer_external section (which has a url setting pointing to the service URL, and a skip_certificate_check boolean to allow self-signed certs).

Quite some refactoring is done to optimize for this situation.

Mind that some webhosts also restrict outgoing traffic altogether or to atypical ports.

Real world use case: iTop environment hosted on One.com servers. Outgoing traffic seems to be needed on a typical port (443).