Skip to content
Snippets Groups Projects
Commit c98de6ae authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA
Browse files

Merge branch 'development' into 'master'

Update Node + Conf SMTP avec SSL

See merge request !11
parents 09eef796 b7d89f10
Branches
Tags v1.3.0
1 merge request!11Update Node + Conf SMTP avec SSL
Pipeline #30289 passed
FROM node:12.13-slim
FROM node:14-slim
# Create app directory
WORKDIR /app
......
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,16 +9,30 @@ 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;
this._config.smtpConfig.auth.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;
}
get config() {
const filteredConf = { ...this._config };
if (
!this._config.smtpConfig.auth.user &&
!this._config.smtpConfig.auth.pass
) {
delete this._config.smtpConfig.auth;
}
return this._config;
}
}
\ No newline at end of file
}
......@@ -7,10 +7,10 @@ export const config = {
// do not fail on invalid certs
rejectUnauthorized: false,
},
// auth: {
// user: process.env.SMTP_USER,
// pass: process.env.SMTP_PASS
// }
auth: {
user: null,
pass: null,
},
},
userSupportMailbox: '',
imageHost: '',
......@@ -21,4 +21,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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment