Get rid of unnecessary .env var - document it

This commit is contained in:
Robert Schäfer 2019-06-20 00:09:26 +02:00
parent 3f5e9a21cc
commit 61ad100bfb
4 changed files with 17 additions and 15 deletions

View File

@ -5,8 +5,8 @@ GRAPHQL_PORT=4000
GRAPHQL_URI=http://localhost:4000
CLIENT_URI=http://localhost:3000
MOCKS=false
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_HOST=
SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=

View File

@ -44,6 +44,9 @@ or start the backend in production environment with:
yarn run start
```
For e-mail delivery, please configure at least `SMTP_HOST` and `SMTP_PORT` in
your `.env` configuration file.
Your backend is up and running at [http://localhost:4000/](http://localhost:4000/)
This will start the GraphQL service \(by default on localhost:4000\) where you
can issue GraphQL requests or access GraphQL Playground in the browser.

View File

@ -2,18 +2,18 @@ import dotenv from 'dotenv'
dotenv.config()
export const requiredConfigs = {
MAPBOX_TOKEN: process.env.MAPBOX_TOKEN,
JWT_SECRET: process.env.JWT_SECRET,
PRIVATE_KEY_PASSPHRASE: process.env.PRIVATE_KEY_PASSPHRASE,
}
const {
MAPBOX_TOKEN,
JWT_SECRET,
PRIVATE_KEY_PASSPHRASE,
SMTP_HOST,
SMTP_PORT,
SMTP_USERNAME,
SMTP_PASSWORD,
} = process.env
export const smtpConfigs = {
SMTP_HOST: process.env.SMTP_HOST || 'localhost',
SMTP_PORT: process.env.SMTP_PORT || 1025,
SMTP_USERNAME: process.env.SMTP_USERNAME,
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
}
export const requiredConfigs = { MAPBOX_TOKEN, JWT_SECRET, PRIVATE_KEY_PASSPHRASE }
export const smtpConfigs = { SMTP_HOST, SMTP_PORT, SMTP_USERNAME, SMTP_PASSWORD }
export const neo4jConfigs = {
NEO4J_URI: process.env.NEO4J_URI || 'bolt://localhost:7687',
@ -28,7 +28,6 @@ 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,7 +41,7 @@ export default {
requestPasswordReset: async (_, { email }, { driver }) => {
const code = uuid().substring(0, 6)
await createPasswordReset({ driver, code, email })
if (CONFIG.SEND_MAILS) {
if (CONFIG.SMTP_HOST && CONFIG.SMTP_PORT) {
await transporter().sendMail({
from: '"Human Connection" <info@human-connection.org>', // sender address
to: email, // list of receivers