]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use conf for rgw_swift_url[_prefix] instead of fcgi env
authorSage Weil <sage@newdream.net>
Wed, 5 Oct 2011 22:28:37 +0000 (15:28 -0700)
committerSage Weil <sage@newdream.net>
Thu, 6 Oct 2011 04:30:29 +0000 (21:30 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/common/config_opts.h
src/rgw/rgw_rest.cc
src/rgw/rgw_swift_auth.cc

index 41de46b82f4925cdc500526a15b3cd1897ddc0f5..065c3a2ea252368e51f3df72a0bd3b1d48640678 100644 (file)
@@ -326,6 +326,8 @@ OPTION(rgw_cache_enabled, OPT_BOOL, false)   // rgw cache enabled
 OPTION(rgw_cache_lru_size, OPT_INT, 10000)   // num of entries in rgw cache
 OPTION(rgw_socket_path, OPT_STR, "")   // path to unix domain socket, if not specified, rgw will not run as external fcgi
 OPTION(rgw_dns_name, OPT_STR, "")
+OPTION(rgw_swift_url, OPT_STR, "")              // 
+OPTION(rgw_swift_url_prefix, OPT_STR, "swift")  // 
 OPTION(rgw_print_continue, OPT_BOOL, true)  // enable if 100-Continue works
 OPTION(rgw_remote_addr_param, OPT_STR, "REMOTE_ADDR")  // e.g. X-Forwarded-For, if you have a reverse proxy
 OPTION(rgw_op_thread_timeout, OPT_INT, 10*60)
index 9ded69ab1fc4fb242fd20ddaf43fe0cd5895a93f..d372dec0a67503d0dd7377d50c864300c6a18e29 100644 (file)
@@ -425,12 +425,9 @@ void init_entities_from_header(struct req_state *s)
 
   pos = req.find('/');
   if (pos >= 0) {
-    const char *swift_url_prefix = s->env->get("RGW_SWIFT_URL_PREFIX");
-    bool cut_url = (swift_url_prefix != NULL);
-    if (!swift_url_prefix)
-      swift_url_prefix = "v1";
+    bool cut_url = g_conf->rgw_swift_url_prefix.length();
     first = req.substr(0, pos);
-    if (first.compare(swift_url_prefix) == 0) {
+    if (first.compare(g_conf->rgw_swift_url_prefix) == 0) {
       s->prot_flags |= RGW_REST_SWIFT;
       if (cut_url) {
         next_tok(req, first, '/');
index f62f373b7ce72e1f62d601a82bc45dac68efb57f..ed29e8becc264770ec86d0e7206138fa86c3dc26 100644 (file)
@@ -127,15 +127,14 @@ void RGW_SWIFT_Auth_Get::execute()
 
   const char *key = s->env->get("HTTP_X_AUTH_KEY");
   const char *user = s->env->get("HTTP_X_AUTH_USER");
-  const char *url_prefix = s->env->get("RGW_SWIFT_URL_PREFIX");
-  const char *os_url = s->env->get("RGW_SWIFT_URL");
 
   string user_str = user;
   RGWUserInfo info;
   bufferlist bl;
 
-  if (!os_url || !url_prefix) {
-    dout(0) << "server is misconfigured, missing RGW_SWIFT_URL_PREFIX or RGW_SWIFT_URL" << dendl;
+  if (g_conf->rgw_swift_url.length() == 0 ||
+      g_conf->rgw_swift_url_prefix.length() == 0) {
+    dout(0) << "server is misconfigured, missing rgw_swift_url_prefix or rgw_swift_url" << dendl;
     ret = -EINVAL;
     goto done;
   }
@@ -152,7 +151,8 @@ void RGW_SWIFT_Auth_Get::execute()
     goto done;
   }
 
-  CGI_PRINTF(s, "X-Storage-Url: %s/%s/v1/AUTH_rgw\n", os_url, url_prefix);
+  CGI_PRINTF(s, "X-Storage-Url: %s/%s/v1/AUTH_rgw\n", g_conf->rgw_swift_url.c_str(),
+            g_conf->rgw_swift_url_prefix);
 
   if ((ret = encode_token(info.swift_name, info.swift_key, bl)) < 0)
     goto done;