Skip to main content

Trubudget Email Service

Environment Variables

Env Variable nameRequiredDefault ValueDescription
AUTHENTICATIONnojwtIf set to none, no JWT-Token is required for all endpoints. If set JWT, a JWT token is necessary.
PORTno8890The port used to expose the email-notification service. Value is a port with minimal value 0 and maximal value 65535
DB_TYPEnopgType of database. A currently supported list can be found in the Database Configuration section.
DB_USERnopostgresUser name for connected database.
DB_PASSWORDnotestPassword for connected database.
DB_HOSTnolocalhostIP/host of connected database.
DB_NAMEnotrubudget_email_serviceName of the database.
DB_PORTno5432Port of connected database. Value is a port with minimal value 0 and maximal value 65535
DB_SSLno-If true the DB connection is using the SSL protocol
DB_SCHEMAnopublicSchema of connected database
SQL_DEBUGno-The SQL Debug option is forwarded to the knex configuration.
USER_TABLEnousersName of the table which is created if the first email address is inserted.
SMTP_HOSTnolocalhostIP/host of external SMTP-Server used to actually send notification emails.
SMTP_PORTno2500Port of external SMTP-Server. Value is a port with minimal value 0 and maximal value 65535
SMTP_SSLno-If true the external SMTP-Server connection is using the SSL protocol.
SMTP_USERno-This is forwarded to the auth prop of the nodemailer's transport-options, to authenticate with the credentials of the configured SMTP server.
SMTP_PASSWORDno-Password of external SMTP-Server used to actually send notification emails.
EMAIL_FROMyes-This is injected into the from field of the email notification.
EMAIL_SUBJECTnoTrubudget NotificationThis is injected into the subject field of the email notification.
EMAIL_TEXTnoYou have received a notification.This is injected into the body of the email notification.
ACCESS_CONTROL_ALLOW_ORIGINno*Since the service uses CORS, the domain by which it can be called needs to be set. Setting this value to * means that it can be called from any domain. Read more about this topic here.
RATE_LIMITno-Defines the limit each IP to RATE_LIMIT requests per windowMs (1 minute)
JWT_SECRETyes (if JWT_ALGORITM=HS256)-If JWT_ALGORITHM is set to HS256, this is required and holds a secret to verify API-issued JWTs, with 32 length. If JWT_ALGORITHM is RS256, leave blank.
JWT_ALGORITHMnoHS256Algorithm used for signing and verifying JWTs. Currently HS256 or RS256 are supported.
JWT_PUBLIC_KEYyes (if JWT_ALGORITHM=RS256)-If JWT_ALGORITHM is set to RS256, this is required and holds BASE64 encoded PEM encoded public key for RSA.
LOG_LEVELnoinfoDefines the log output.
PRETTY_PRINTno-If true the log output is pretty printed.

JWT_SECRET

The JWT_SECRET is shared between Trubudget's blockchain api and email-service. The endpoints of the email-service can only be used by providing a valid JWT_TOKEN signed with this JWT_SECRET. Since the blockchain is using the notification endpoints and the ui is using the user endpoints the secret has to be shared.