forked from mailvelope/keyserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify configuration for different environments
- Loading branch information
Showing
18 changed files
with
94 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.DS_Store | ||
credentials.json | ||
.vscode | ||
|
||
# Logs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
|
||
log: { | ||
level: 'silly' | ||
}, | ||
|
||
server: { | ||
port: process.env.PORT || 8888, | ||
}, | ||
log: { | ||
level: "silly" | ||
|
||
mongo: { | ||
uri: process.env.MONGO_URI, | ||
user: process.env.MONGO_USER, | ||
pass: process.env.MONGO_PASS | ||
}, | ||
|
||
email: { | ||
host: process.env.SMTP_HOST, | ||
port: process.env.SMTP_PORT, | ||
tls: process.env.SMTP_TLS, | ||
starttls: process.env.SMTP_STARTTLS, | ||
pgp: process.env.SMTP_PGP, | ||
auth: { | ||
user: process.env.SMTP_USER, | ||
pass: process.env.SMTP_PASS | ||
}, | ||
sender: { | ||
name: process.env.SENDER_NAME, | ||
email: process.env.SENDER_EMAIL | ||
} | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
|
||
log: { | ||
level: "warn" | ||
level: 'warn' | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
|
||
log: { | ||
level: "error" | ||
level: 'error' | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,49 +3,27 @@ | |
require('co-mocha')(require('mocha')); // monkey patch mocha for generators | ||
|
||
const expect = require('chai').expect; | ||
const log = require('npmlog'); | ||
const config = require('config'); | ||
const Email = require('../../src/email/email'); | ||
const nodemailer = require('nodemailer'); | ||
const openpgpEncrypt = require('nodemailer-openpgp').openpgpEncrypt; | ||
const tpl = require('../../src/email/templates.json'); | ||
|
||
log.level = config.log.level; | ||
|
||
describe('Email Integration Tests', function() { | ||
this.timeout(20000); | ||
|
||
let email, credentials, userId, origin, publicKeyArmored; | ||
let email, userId, origin, publicKeyArmored; | ||
|
||
const recipient = { name:'Test User', email:'[email protected]' }; | ||
|
||
before(function() { | ||
try { | ||
credentials = require('../../credentials.json'); | ||
} catch(e) { | ||
log.info('email-test', 'No credentials.json found ... using environment vars.'); | ||
} | ||
publicKeyArmored = require('fs').readFileSync(__dirname + '/../key1.asc', 'utf8'); | ||
origin = { | ||
protocol: 'http', | ||
host: 'localhost:' + config.server.port | ||
}; | ||
email = new Email(nodemailer, openpgpEncrypt); | ||
email.init({ | ||
host: process.env.SMTP_HOST || credentials.smtp.host, | ||
port: process.env.SMTP_PORT || credentials.smtp.port, | ||
tls: (process.env.SMTP_TLS || credentials.smtp.tls) === 'true', | ||
starttls: (process.env.SMTP_STARTTLS || credentials.smtp.starttls) === 'true', | ||
pgp: (process.env.SMTP_PGP || credentials.smtp.pgp) === 'true', | ||
auth: { | ||
user: process.env.SMTP_USER || credentials.smtp.user, | ||
pass: process.env.SMTP_PASS || credentials.smtp.pass | ||
}, | ||
sender: { | ||
name: process.env.SENDER_NAME || credentials.sender.name, | ||
email: process.env.SENDER_EMAIL || credentials.sender.email | ||
} | ||
}); | ||
email.init(config.email); | ||
}); | ||
|
||
beforeEach(() => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.