Disable SEND_MAILS for local development and test

.. but enable it by default for `docker-compose.override.yml`. If the developer
uses `docker-compose` we can safely assume that a local smtp server for
development is running.
This commit is contained in:
Robert Schäfer 2019-06-19 14:47:10 +02:00
parent c85c94aa40
commit 3f5e9a21cc
4 changed files with 20 additions and 7 deletions

View File

@ -5,6 +5,10 @@ GRAPHQL_PORT=4000
GRAPHQL_URI=http://localhost:4000
CLIENT_URI=http://localhost:3000
MOCKS=false
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USERNAME=
SMTP_PASSWORD=
JWT_SECRET="b/&&7b78BF&fv/Vd"
MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ"

View File

@ -28,6 +28,7 @@ export const serverConfigs = {
}
export const developmentConfigs = {
SEND_MAILS: process.env.SEND_MAILS || false,
DEBUG: process.env.NODE_ENV !== 'production' && process.env.DEBUG === 'true',
MOCKS: process.env.MOCKS === 'true',
DISABLED_MIDDLEWARES:

View File

@ -41,13 +41,15 @@ export default {
requestPasswordReset: async (_, { email }, { driver }) => {
const code = uuid().substring(0, 6)
await createPasswordReset({ driver, code, email })
await transporter().sendMail({
from: '"Human Connection" <info@human-connection.org>', // sender address
to: email, // list of receivers
subject: 'Password Reset', // Subject line
text: `Code is ${code}`, // plain text body
html: `Code is <b>${code}</b>`, // plain text body
})
if (CONFIG.SEND_MAILS) {
await transporter().sendMail({
from: '"Human Connection" <info@human-connection.org>', // sender address
to: email, // list of receivers
subject: 'Password Reset', // Subject line
text: `Code is ${code}`, // plain text body
html: `Code is <b>${code}</b>`, // plain text body
})
}
return true
},

View File

@ -5,6 +5,8 @@ services:
image: djfarrelly/maildev
ports:
- 1080:80
networks:
- hc-network
webapp:
build:
context: webapp
@ -24,6 +26,10 @@ services:
- backend_node_modules:/nitro-backend/node_modules
- uploads:/nitro-backend/public/uploads
command: yarn run dev
environment:
- SEND_MAILS=true
- SMTP_HOST=mailserver
- SMTP_PORT=25
neo4j:
environment:
- NEO4J_AUTH=none