Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added better boolean env checks and requireTLS option to prod mail se… #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
.Trashes
ehthumbs.db
Thumbs.db
examples/your*
14 changes: 8 additions & 6 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ function CheckEnvVar(varname, defaultvalue)
// Domain Variables
var devDomain = CheckEnvVar('DEV_DOMAIN', 'http://localhost:2368');
var devSSLDomain = CheckEnvVar('DEV_SSL_DOMAIN', ''); // Won't advertise its useage, but it's there
var devForceAdminSSL= CheckEnvVar('DEV_FORCE_ADMIN_SSL', false);
var devForceAdminSSL= CheckEnvVar('DEV_FORCE_ADMIN_SSL', 'false') === 'false';

var prodDomain = CheckEnvVar('PROD_DOMAIN', 'http://example.com');
var prodSSLDomain = CheckEnvVar('PROD_SSL_DOMAIN', ''); // Won't advertise its useage, but it's there
var prodForceAdminSSL= CheckEnvVar('DEV_FORCE_ADMIN_SSL', false);
var prodForceAdminSSL= CheckEnvVar('DEV_FORCE_ADMIN_SSL', 'false') === 'false';

//Development Mail Variables
var devMailTransport = CheckEnvVar('DEV_MAIL_TRANSPORT', '');
Expand All @@ -33,9 +33,9 @@ var devMailName = CheckEnvVar('DEV_MAIL_NAME', '');
var devMailUser = CheckEnvVar('DEV_MAIL_USER', '');
var devMailPass = CheckEnvVar('DEV_MAIL_PASS', '');
var devMailFrom = CheckEnvVar('DEV_MAIL_FROM', '');
var devMailSecureConnection = CheckEnvVar('DEV_MAIL_SECURE_CONNECTION', false);
var devMailSecureConnection = CheckEnvVar('DEV_MAIL_SECURE_CONNECTION', 'false') === 'true';
var devMailPort = CheckEnvVar('DEV_MAIL_PORT', 25);
var devMailIgnoreTLS = CheckEnvVar('DEV_MAIL_IGNORE_TLS', false);
var devMailIgnoreTLS = CheckEnvVar('DEV_MAIL_IGNORE_TLS', 'true') === 'true';
var devMailDebug = CheckEnvVar('DEV_MAIL_DEBUG', '');

if (devMailService != '') {
Expand All @@ -52,10 +52,11 @@ var prodMailName = CheckEnvVar('DEV_MAIL_NAME', '');
var prodMailUser = CheckEnvVar('PROD_MAIL_USER', '');
var prodMailPass = CheckEnvVar('PROD_MAIL_PASS', '');
var prodMailFrom = CheckEnvVar('PROD_MAIL_FROM', '');
var prodMailSecureConnection = CheckEnvVar('PROD_MAIL_SECURE_CONNECTION', false);
var prodMailSecureConnection = CheckEnvVar('PROD_MAIL_SECURE_CONNECTION', 'false') === 'true';
var prodMailPort = CheckEnvVar('PROD_MAIL_PORT', 25);
var prodMailIgnoreTLS = CheckEnvVar('PROD_MAIL_IGNORE_TLS', false);
var prodMailIgnoreTLS = CheckEnvVar('PROD_MAIL_IGNORE_TLS', 'false') === 'true';
var prodMailDebug = CheckEnvVar('PROD_MAIL_DEBUG', '');
var prodMailRequireTLS = CheckEnvVar('PROD_MAIL_REQUIRE_TLS', 'true') === 'true'

if (prodMailService != '') {
prodMailHost = undefined
Expand All @@ -76,6 +77,7 @@ config = {
transport: prodMailTransport,
options: {
ignoreTLS: prodMailIgnoreTLS,
requireTLS: prodMailRequireTLS,
host: prodMailHost,
port: prodMailPort,
debug: prodMailDebug,
Expand Down