Skip to content
GitHub

Configuration

The package defines three independent config sections: notification (SMS + push), mailer (email), and inbox (in-app notifications). Each has its own env prefix.


Section key: notification — loaded from notification: in application.yaml or via LEX_NOTIFICATION__* env vars.

notification:
sms_backends:
- name: primary
primary: true
driver: twilio
twilio:
account_sid: "${TWILIO_ACCOUNT_SID}"
auth_token: "${TWILIO_AUTH_TOKEN}"
from_number: "+15551234567"
timeout: 30
push_backends:
- name: mobile
primary: true
driver: fcm
fcm:
server_key: "${FCM_SERVER_KEY}"
- name: ios
driver: apns
apns:
team_id: ABC123DEFG
key_id: XYZ789ABCD
bundle_id: com.example.app
sandbox: false
- name: web
driver: web_push
web_push:
vapid_public_key: "${VAPID_PUBLIC_KEY}"
vapid_private_key: "${VAPID_PRIVATE_KEY}"
vapid_claims_subject: mailto:ops@example.com
KeyTypeDefaultEnv VarDescription
sms_backendslist[NamedSMSConfig][](list)Named SMS backends
push_backendslist[NamedPushConfig][](list)Named push backends
KeyTypeDefaultDescription
namestr(required)Backend name for Named() DI
primaryboolFalseAlso register under unnamed SMSChannelProtocol
driverstr"twilio"SMS driver name
twilioTwilioDriverConfig | NoneNoneTwilio-specific config
KeyTypeDefaultEnv VarDescription
account_sidstr | NoneNoneLEX_NOTIFICATION__SMS_BACKENDS__0__TWILIO__ACCOUNT_SIDTwilio Account SID
auth_tokenstr | NoneNoneLEX_NOTIFICATION__SMS_BACKENDS__0__TWILIO__AUTH_TOKENTwilio Auth Token
from_numberstr | NoneNone_Twilio phone number (E.164)
timeoutint30_HTTP timeout (seconds)
KeyTypeDefaultDescription
namestr(required)Backend name for Named() DI
primaryboolFalseAlso register under unnamed PushChannelProtocol
driverstr"fcm"Push driver: fcm, apns, web_push
fcmFCMDriverConfig | NoneNoneFCM-specific config
apnsAPNsDriverConfig | NoneNoneAPNs-specific config
web_pushWebPushDriverConfig | NoneNoneWeb Push config
KeyTypeDefaultDescription
server_keystr | NoneNoneFCM Server API Key
timeoutint30HTTP timeout (seconds)
KeyTypeDefaultDescription
team_idstr | NoneNoneApple Developer Team ID (10 chars)
key_idstr | NoneNoneAPNs Auth Key ID (10 chars)
apns_auth_keystr | NoneNoneECDSA private key (PEM string or .p8 path)
bundle_idstr | NoneNoneApp bundle identifier
sandboxboolFalseUse APNs sandbox endpoint
timeoutint30HTTP timeout (seconds)
KeyTypeDefaultDescription
vapid_private_keystr | NoneNoneVAPID private key (PEM-encoded EC prime256v1)
vapid_public_keystr | NoneNoneVAPID public key (base64url)
vapid_claims_subjectstr | NoneNoneVAPID claims subject URI
timeoutint30HTTP timeout (seconds)

Section key: mailer — loaded from mailer: in application.yaml or via LEX_NOTIFICATION__MAILER__* env vars.

mailer:
backends:
- name: transactional
primary: true
driver: sendgrid
from_email: orders@example.com
from_name: Orders
sendgrid:
api_key: "${SENDGRID_API_KEY}"
sandbox_mode: false
- name: internal
driver: smtp
from_email: alerts@example.com
smtp:
host: smtp.example.com
port: 587
username: "${SMTP_USER}"
password: "${SMTP_PASS}"
use_tls: true
KeyTypeDefaultEnv VarDescription
backendslist[NamedMailerConfig][](list)Named mailer backends
KeyTypeDefaultDescription
namestr(required)Backend name for Named() DI
primaryboolFalseAlso register under unnamed MailerProtocol
driverstr"smtp"Mailer driver: smtp, sendgrid
from_emailstr | NoneNoneDefault sender email
from_namestr | NoneNoneDefault sender name
smtpSMTPDriverConfig | NoneNoneSMTP-specific config
sendgridSendGridDriverConfig | NoneNoneSendGrid-specific config
KeyTypeDefaultDescription
hoststr"localhost"SMTP server hostname
portint587SMTP port
usernamestr | NoneNoneSMTP auth username
passwordstr | NoneNoneSMTP auth password
use_tlsboolTrueUse STARTTLS
use_sslboolFalseUse SSL from connect (port 465)
timeoutint30Connection timeout (seconds)
KeyTypeDefaultDescription
api_keystr | NoneNoneSendGrid API key
timeoutint30HTTP timeout (seconds)
sandbox_modeboolFalseSandbox mode (emails not sent)

Section key: inbox — loaded from inbox: in application.yaml or via LEX_NOTIFICATION__INBOX__* env vars.

inbox:
store_backend: database
max_page_size: 50
retention_days: 30
mark_read_on_fetch: false
KeyTypeDefaultEnv VarDescription
store_backendstr"database"LEX_NOTIFICATION__INBOX__STORE_BACKENDStorage: database or memory
max_page_sizeint50LEX_NOTIFICATION__INBOX__MAX_PAGE_SIZEMax messages per page
retention_daysint30LEX_NOTIFICATION__INBOX__RETENTION_DAYSDays before message pruning
mark_read_on_fetchboolFalseLEX_NOTIFICATION__INBOX__MARK_READ_ON_FETCHAuto-mark read on fetch

All three sections use __ as the nested delimiter:

Terminal window
# Set Twilio credentials for the first SMS backend
export LEX_NOTIFICATION__SMS_BACKENDS__0__TWILIO__ACCOUNT_SID="AC..."
# Set SendGrid API key for the mailer
export LEX_NOTIFICATION__MAILER__BACKENDS__0__SENDGRID__API_KEY="SG..."
# Set inbox retention
export LEX_NOTIFICATION__INBOX__RETENTION_DAYS=90