Adding the option to set the binding port 21/7521/1
authorJacques Samain <[email protected]>
Tue, 11 Jul 2017 15:10:08 +0000 (17:10 +0200)
committerJacques Samain <[email protected]>
Tue, 11 Jul 2017 15:10:08 +0000 (17:10 +0200)
Change-Id: Ibc6ab07c5430f923310771195e913616efb654ab
Signed-off-by: Jacques Samain <[email protected]>
main.cc

diff --git a/main.cc b/main.cc
index ab661d7..e5eb804 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -79,10 +79,10 @@ int main(int argc, char **argv) {
   string root_folder = "/var/www/html";
   string webserver_prefix = "http://webserver";
   string proxy_address = "";
-
+  int port = 8080;
   int opt = 0;
 
-  while ((opt = getopt(argc, argv, "p:l:hx:")) != -1) {
+  while ((opt = getopt(argc, argv, "p:l:o:hx:")) != -1) {
 
     switch (opt) {
       case 'p':
@@ -94,6 +94,9 @@ int main(int argc, char **argv) {
       case 'x':
         proxy_address = optarg;
         break;
+      case 'o':
+        port = atoi(optarg);
+        break;
       case 'h':
       default:
         usage(argv[0]);
@@ -119,7 +122,7 @@ int main(int argc, char **argv) {
   std::cout << "Using locator: [" << webserver_prefix << "]" << std::endl;
 
   boost::asio::io_service io_service;
-  HttpServer server(8080, webserver_prefix, 50, 5, 300, io_service);
+  HttpServer server(port, webserver_prefix, 50, 5, 300, io_service);
 
   // GET for the path /info
   // Responds with some server info