Commit 497ba637 authored by Fabien Forestier's avatar Fabien Forestier
Browse files

Adding config in order to be able to add user and password for SMTP server

parent 430dfb60
Pipeline #7047 passed with stage
in 6 seconds
version: "3.1"
version: '3.1'
services:
mail-service:
build: .
image: registry.forge.grandlyon.com/web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/services/mailer:${TAG}
......@@ -10,6 +9,8 @@ services:
environment:
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- MAIL_SUBJECT_PREFIX=${MAIL_SUBJECT_PREFIX}
- USER_SUPPORT_MAILBOX=${USER_SUPPORT_MAILBOX}
- NO_REPLY_MAIL_ADDRESS=${NO_REPLY_MAIL_ADDRESS}
......@@ -17,4 +18,4 @@ services:
- GROUP_HEADER=x-consumer-groups
- EMAIL_WRITER_GROUP_NAME=email-writer
- IMAGE_HOST=https://minio.alpha.grandlyon.com/email-template-assets
restart: unless-stopped
\ No newline at end of file
restart: unless-stopped
......@@ -9,10 +9,18 @@ export class ConfigService {
// Initializing conf with values from var env
this._config.smtpConfig.host = process.env.SMTP_HOST;
this._config.smtpConfig.port = process.env.SMTP_PORT;
if (process.env.SMTP_USER && process.env.SMTP_PASSWORD) {
this._config.smtpConfig.auth = {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
};
}
this._config.mailSubjectPrefix = process.env.MAIL_SUBJECT_PREFIX;
this._config.userSupportMailbox = process.env.USER_SUPPORT_MAILBOX;
this._config.noReplyMailAddress = process.env.NO_REPLY_MAIL_ADDRESS;
this._config.additionalFeedbackEmails = process.env.ADDITIONAL_FEEDBACK_EMAILS;
this._config.additionalFeedbackEmails =
process.env.ADDITIONAL_FEEDBACK_EMAILS;
this._config.groupHeader = process.env.GROUP_HEADER;
this._config.groupNames.emailWriter = process.env.EMAIL_WRITER_GROUP_NAME;
this._config.imageHost = process.env.IMAGE_HOST;
......@@ -21,4 +29,4 @@ export class ConfigService {
get config() {
return this._config;
}
}
\ No newline at end of file
}
......@@ -7,10 +7,6 @@ export const config = {
// do not fail on invalid certs
rejectUnauthorized: false,
},
// auth: {
// user: process.env.SMTP_USER,
// pass: process.env.SMTP_PASS
// }
},
userSupportMailbox: '',
imageHost: '',
......@@ -21,4 +17,4 @@ export const config = {
mailSubjectPrefix: '',
noReplyMailAddress: '',
additionalFeedbackEmails: '',
};
\ No newline at end of file
};
......@@ -2,6 +2,8 @@ TAG=<version of the service to deploy>
SMTP_HOST=<host of the SMTP server>
SMTP_PORT=<port of the SMTP server>
SMTP_USER=<username of the SMTP server>
SMTP_PASSWORD=<password for the user of the SMTP server>
MAIL_SERVICE_BIND_PORT=<listening port of the service>
MAIL_SUBJECT_PREFIX=<prefix used in email subject>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment