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

adding the "--public" flag to allow users to open the drakov server to #55

Merged
merged 1 commit into from
May 16, 2015
Merged
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
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);
}
}

};