Advanced configuration
Mailer service is fully configurable by environment variables. A full list of available configuration is below.
Production usage
It is recommended to create a project specific image of mailer that will ba based on tshio/mailer
and contain email templates. The easiest way to do so is to create your own Dockerfile
:
FROM tshio/mailer:latest as mailer
COPY templates /app/services/mailer/mail-templates
Supported environment variables
HTTP_PORT:
- Description: The variable specifies port on which the service will be available.
- Default:
"50050"
PROTOCOL_PROTOCOL
- Description: The variable specifies the protocol of mailer service communication.
- Default:
"http"
TRANSPORT_TYPE
- Description: The variable specifies the transport type.
- Default:
"smtp"
TRANSPORT_SMTP_POOL
- Description: The variable enables SMTP pool.
- Default:
false
TRANSPORT_SMTP_HOST
- Description: The variable specifies host name of SMTP Server.
- Default:
""
TRANSPORT_SMTP_PORT
- Description: The variable specifies port of SMTP Server.
- Default:
465
TRANSPORT_SMTP_SECURE
- Description: The variable enables secure SMTP connection.
- Default:
false
TRANSPORT_SMTP_AUTH_USER
- Description: The variable specifies the username for SMTP server.
- Default:
""
TRANSPORT_SMTP_AUTH_PASSWORD
- Description: The variable specifies the password for SMTP server.
- Default:
""
TRANSPORT_SMTP_DEBUG
- Description: The variable specifies if SMTP server should be in debug mode.
- Default:
false
TRANSPORT_SMTP_TEMPLATES_ROOT
- Description: The variable specifies the path to mail templates inside docker image.
- Default:
"/app/services/mailer/mail-templates/"
TRANSPORT_SENDGRID_AUTH_KEY
- Description: The variable specifies the auth key of the SendGrid account if you would like to use it instead of using a local SMTP server.
- Default:
""
BATCH_SIZE
- Description: The variable specifies the maximum batch size of consuming emails to send from a queue.
- Default:
1000
BATCH_PERIOD
- Description: The variable specifies a delay between send batch emails. Default is 900s (15min)
- Default:
900
LOG_LEVEL
- Description: The variable specifies the level of logging by the logger available options:
"error"
,"warn"
,"help"
,"info"
,"debug"
,"verbose"
,"silly"
- Default:
"debug"
REQUEST_LOGGER_FORMAT:
- Description: All requests are logged so the DevOps can check if the request comes from a user or other service (we use morgan library to log information). We created our format to display information but fill free to use one of build-in morgan library available options:
"combined"
,"common"
,"dev"
,"short"
,"tiny"
- Default:
":remote-addr :method :url :status :response-time ms - req-body :body - api-key :apiKey - authorization :authorization"
REQUEST_BODY_KEYS_TO_HIDE
- Description: We don't want to look at our users' private data so by default we hide some common properties. If you want to cheng that please provide your string with words you want to hide separated witch coma
,
- Default:
"password,token,accessToken,accessKey,authorization"