Hidden password, allow seeting port

This commit is contained in:
Jan Kaluza 2012-08-29 15:33:43 +02:00
parent cb1e126ab6
commit 35c13f038f
4 changed files with 6 additions and 5 deletions

View file

@ -139,7 +139,7 @@ int main(int argc, char **argv)
}
else if (command[0] == "server") {
Server server(&config);
server.start(8080);
server.start();
while (1) { sleep(10); }
}
else {

View file

@ -31,6 +31,7 @@ bool ManagerConfig::load(const std::string &configfile, boost::program_options::
opts.add_options()
("service.admin_username", value<std::string>()->default_value(""), "Administrator username.")
("service.admin_password", value<std::string>()->default_value(""), "Administrator password.")
("service.port", value<int>()->default_value(8081), "Web interface port.")
("service.config_directory", value<std::string>()->default_value("/etc/spectrum2/transports/"), "Directory with spectrum2 configuration files. One .cfg file per one instance")
("servers.server", value<std::vector<std::string> >()->multitoken(), "Server.")
;

View file

@ -158,9 +158,9 @@ static void *_event_handler(enum mg_event event, struct mg_connection *conn) {
return static_cast<Server *>(request_info->user_data)->event_handler(event, conn);
}
bool Server::start(int port) {
bool Server::start() {
const char *options[] = {
"listening_ports", boost::lexical_cast<std::string>(port).c_str(),
"listening_ports", boost::lexical_cast<std::string>(CONFIG_INT(m_config, "service.port")).c_str(),
"num_threads", "1",
NULL
};
@ -296,7 +296,7 @@ void Server::serve_login(struct mg_connection *conn, const struct mg_request_inf
<br/>\
<form action=\"/authorize\">\
Username: <input type=\"text\" name=\"user\"></input><br/>\
Password: <input type=\"text\" name=\"password\"></input><br/>\
Password: <input type=\"password\" name=\"password\"></input><br/>\
<input type=\"submit\" value=\"Login\"></input>\
</form>\
</center>\

View file

@ -46,7 +46,7 @@ class Server {
/// Destructor
virtual ~Server();
bool start(int port);
bool start();
void *event_handler(enum mg_event event, struct mg_connection *conn);