Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
moving security configs to secure code block to remove requirement fo…
Browse files Browse the repository at this point in the history
…r private key and certificate
  • Loading branch information
jloveland committed Aug 31, 2014
1 parent 7946cfe commit f786dda
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
*/
var fs = require('fs'),
http = require('http'),
https = require('https'),
privateKey = fs.readFileSync('./config/sslcert/key.pem', 'utf8'),
certificate = fs.readFileSync('./config/sslcert/cert.pem', 'utf8'),
credentials = {key: privateKey, cert: certificate},
express = require('express'),
morgan = require('morgan'),
bodyParser = require('body-parser'),
Expand Down Expand Up @@ -149,7 +145,11 @@ module.exports = function(db) {

if (app.locals.secure) {
console.log('Securely using https protocol');
var httpsServer = https.createServer(credentials, app);
var https = require('https'),
privateKey = fs.readFileSync('./config/sslcert/key.pem', 'utf8'),
certificate = fs.readFileSync('./config/sslcert/cert.pem', 'utf8'),
credentials = {key: privateKey, cert: certificate},
httpsServer = https.createServer(credentials, app);
return httpsServer;
} else {
console.log('Insecurely using http protocol');
Expand Down

0 comments on commit f786dda

Please sign in to comment.