Prevent private mode when no user exists

This commit is contained in:
Mattias Erming 2014-10-01 12:05:07 -07:00
parent cb4b6786b2
commit 656900448b

View File

@ -13,7 +13,13 @@ program
.description("Start the server") .description("Start the server")
.action(function() { .action(function() {
var users = new ClientManager().getUsers(); var users = new ClientManager().getUsers();
if (!config.public && !users.length) { var mode = config.public;
if (program.public) {
mode = true;
} else if (program.private) {
mode = false;
}
if (!mode && !users.length) {
console.log(""); console.log("");
console.log("No users found!"); console.log("No users found!");
console.log("Create a new user with 'shout add <name>'."); console.log("Create a new user with 'shout add <name>'.");
@ -21,12 +27,6 @@ program
} else { } else {
var host = program.host || process.env.IP || config.host; var host = program.host || process.env.IP || config.host;
var port = program.port || process.env.PORT || config.port; var port = program.port || process.env.PORT || config.port;
var mode = config.public;
if (program.public) {
mode = true;
} else if (program.private) {
mode = false;
}
shout(port, host, mode); shout(port, host, mode);
} }
}); });