Skip to content

Commit

Permalink
Instead of using ssl options with a boolean value for spdy, just use …
Browse files Browse the repository at this point in the history
…spdy options object
  • Loading branch information
larzconwell committed Aug 14, 2012
1 parent b68adda commit 2bda327
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/cluster/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ Worker.prototype = new (function () {
var ssl = this.config.ssl
, spdy = this.config.spdy;

// If SSL options were given
if (ssl) {
if (ssl.cert && ssl.key) {
if(spdy) {
this.server = utils.file.requireLocal('spdy');
} else {
this.server = require('https');
}

this.server = this.server.createServer({
this.server = require('https').createServer({
key: fs.readFileSync(ssl.key)
, cert: fs.readFileSync(ssl.cert)
});
Expand All @@ -54,6 +49,20 @@ Worker.prototype = new (function () {
'Missing certificate or private key.');
}
}
// If SPDY options were given
else if (spdy) {
if (spdy.cert && spdy.key) {
this.server = utils.file.requireLocal('spdy').createServer({
key: fs.readFileSync(spdy.key)
, cert: fs.readFileSync(spdy.cert)
});
}
else {
this.log.error('Cannot start server using SPDY.' +
'Missing certificate or private key.');
}
}
// If neither SSL or SPDY options were given use HTTP
else {
this.server = require('http').createServer();
}
Expand Down

0 comments on commit 2bda327

Please sign in to comment.