Skip to content

Commit

Permalink
Merge pull request #55 from obihann/master
Browse files Browse the repository at this point in the history
adding the "--public" flag to allow users to open the drakov server to
  • Loading branch information
yakovkhalinsky committed May 16, 2015
2 parents 7c00f8a + 8fb310f commit 8e856e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ var optimistOptions = {
},
method: {
description: 'Add method to Access-Control-Allow-Methods response header'
},
public: {
description: 'Allow external requests',
default: false
}

};

exports.getArgv = function() {
Expand Down
17 changes: 15 additions & 2 deletions lib/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ exports.startServer = function (argv, app, cb) {
console.log(' STEALTH MODE '.grey.bold.inverse, 'running silently'.grey);
}

if (argv.public) {
console.log(' PUBLIC MODE '.grey.bold.inverse, 'running publicly'.grey);
}

if (cb) {
cb();
}
Expand All @@ -25,9 +29,18 @@ exports.startServer = function (argv, app, cb) {
cert: fs.readFileSync(argv.sslCrtFile, 'utf8' ),
rejectUnauthorized: false
};
return https.createServer(sslOptions, app).listen(argv.serverPort, 'localhost', startCb);

if (argv.public === true) {
return https.createServer(sslOptions, app).listen(argv.serverPort, startCb);
} else {
return https.createServer(sslOptions, app).listen(argv.serverPort, 'localhost', startCb);
}
} else {
return app.listen(argv.serverPort, 'localhost', startCb);
if (argv.public === true) {
return app.listen(argv.serverPort, startCb);
} else {
return app.listen(argv.serverPort, 'localhost', startCb);
}
}

};

0 comments on commit 8e856e5

Please sign in to comment.