From 4f3829a67c32a85fb57c65b3704e08d64f76d92f Mon Sep 17 00:00:00 2001 From: Brian Kruger Date: Wed, 27 Jul 2016 14:29:45 -0700 Subject: [PATCH] Add ability to force email and real name fields via env file. TODO: apply these changes to frontend ui as well. --- .env.SAMPLE | 6 ++++++ README.md | 7 ++++++- deploy/apex/webpack.config.es6.js | 9 +++++++++ packages/frontend/src/ui/postCommentForm.js | 4 ++-- packages/lambda/src/queueComment/index.js | 7 +++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.env.SAMPLE b/.env.SAMPLE index 8ff6652..0d8bfc2 100644 --- a/.env.SAMPLE +++ b/.env.SAMPLE @@ -19,3 +19,9 @@ STAGE=prod # A Slack webhook to send notifications to (optional) #SLACK=https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ +# Require author email address - string is error message to display. +#REQEMAIL='Email is required.' + +# Require author name - string is error message to display. +#REQNAME='Name is required.' + diff --git a/README.md b/README.md index 1e14d66..5ca3ff0 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,12 @@ STAGE=prod # A Slack webhook to send notifications to (optional) #SLACK=https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZZZZZ -``` + +# Require author email address - string is error message to display. +#REQEMAIL='Email is required.' + +# Require author name - string is error message to display. +#REQNAME='Name is required.' We use [dotenv](https://github.com/motdotla/dotenv) so it is also possible to configure the project by setting environment variables. diff --git a/deploy/apex/webpack.config.es6.js b/deploy/apex/webpack.config.es6.js index eeebdcb..b24de58 100644 --- a/deploy/apex/webpack.config.es6.js +++ b/deploy/apex/webpack.config.es6.js @@ -37,6 +37,15 @@ if (process.env.SLACK) { defines['process.env.SLACK'] = `'${process.env.SLACK}'` } +if (process.env.REQEMAIL) { + defines['process.env.REQEMAIL'] = `'${process.env.REQEMAIL}'` +} + +if (process.env.REQNAME) { + defines['process.env.REQNAME'] = `'${process.env.REQNAME}'` +} + + export default { entry: { [lambdaDirNames['QueueComment']]: [ diff --git a/packages/frontend/src/ui/postCommentForm.js b/packages/frontend/src/ui/postCommentForm.js index d6b636b..1e2209e 100644 --- a/packages/frontend/src/ui/postCommentForm.js +++ b/packages/frontend/src/ui/postCommentForm.js @@ -175,7 +175,7 @@ export default class PostCommentForm extends Component { }