]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: configurable mongoose port
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 23 Oct 2013 19:03:42 +0000 (12:03 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 5 Nov 2013 04:28:13 +0000 (20:28 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/common/config_opts.h
src/rgw/rgw_main.cc

index 0b3938ecb9e53402c186fda16b4a7bd5ec768ca3..ef9d4bd0746b6e509e245ac0342c1e50edaffef3 100644 (file)
@@ -727,6 +727,8 @@ OPTION(rgw_bucket_quota_ttl, OPT_INT, 600) // time for cached bucket stats to be
 OPTION(rgw_bucket_quota_soft_threshold, OPT_DOUBLE, 0.95) // threshold from which we don't rely on cached info for quota decisions
 OPTION(rgw_bucket_quota_cache_size, OPT_INT, 10000) // number of entries in bucket quota cache
 
+OPTION(rgw_standalone_server_port, OPT_INT, 0) // 0 means disabled
+
 OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
 
 // This will be set to true when it is safe to start threads.
index 2343bd61b936d21c5f1587750ae6e1a6b799987f..930eb3914e87dffb0b710f45f4b690d89608b48b 100644 (file)
@@ -730,13 +730,19 @@ int main(int argc, const char **argv)
     olog->init(g_conf->rgw_ops_log_socket_path);
   }
 
-  struct mg_context *ctx;
-  const char *options[] = {"listening_ports", "8080", "enable_keep_alive", "yes", NULL};
-
+  bool use_mongoose = (g_conf->rgw_standalone_server_port != 0);
+  struct mg_context *ctx = NULL;
   RGWProcessEnv pe = { store, &rest, olog };
 
-  ctx = mg_start((const char **)&options, &mongoose_callback, &pe);
-  assert(ctx);
+  if (use_mongoose) {
+    char port_buf[32];
+    snprintf(port_buf, sizeof(port_buf), "%d", (int)g_conf->rgw_standalone_server_port);
+
+    const char *options[] = {"listening_ports", port_buf, "enable_keep_alive", "yes", NULL};
+
+    ctx = mg_start((const char **)&options, &mongoose_callback, &pe);
+    assert(ctx);
+  }
 
   RGWProcess *pprocess = new RGWProcess(g_ceph_context, &pe, g_conf->rgw_thread_pool_size);
 
@@ -750,7 +756,9 @@ int main(int argc, const char **argv)
 
   pprocess->run();
 
-  mg_stop(ctx);
+  if (use_mongoose) {
+    mg_stop(ctx);
+  }
 
   derr << "shutting down" << dendl;