Embedded Carbone in a Docker image with simple REST API.
Requests require HTTP Basic Authentication. Username and password must be passed to the server process via the USERNAME and PASSWORD environment variables, otherwise it will exit immedately with a non-zero exit code and, thus, stop the container.
Generated reports can be sent via E-Mail if the request has a email field with a JSON object. The object can contain the following properties:
- to: string[] - an Array of strings containing email addresses to which the mail is sent. If left out, empty or invalid, no emails will be sent.
- subject: string - used as a subject line on all sent mails
- text: string - used as the plaintext message body on all sent mails
The SMTP client connection can be configured by a set of environment variables:
- SMTP_HOST, SMTP_PORT - host and port to connect to
- SMTP_USER - username for SMTP authentication and as sender in messages' FROM field
- SMTP_PASSWORD - password for SMTP authentication
- SMTP_UNSAFE: if left undefined or empty (default), will attempt to use TLS encryption.
You can execute npm run smtp-dummy
to launch a local dummy SMTP server that will log all received mails to standard output.
Executing local-run.sh
will setup all environment variables to connect to it and launch the API server.
By default, generated files are sent directly to the client. Set the STORAGE_PATH environment variable to a writable location and they will be stored there.
- each file will be content-hashed
- generated files it will be stored as
<STORAGE_PATH>/<hash>/result.pdf
- files will be retrievable via HTTP GET (authenticated) on
/files/<hash>
- requests to
/render
will not get the file in the response body. Instead, they will be redirected to the above location (status code 301).
The simpliest way to use this image is to use We extended the API with authentication, so this doesn't work anymore. :(node
and install carbone-connect
package.
Fast, Simple and Powerful report generator in any format PDF, DOCX, XLSX, ODT, PPTX, ODS [, ...]
... using your JSON data as input.
See carbone.io website for full Carbone documentation.