rgw: use conf for rgw_swift_url[_prefix] instead of fcgi env

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2011-10-05 15:28:37 -07:00
parent 85cf0a8d90
commit 8f62c3bb18
3 changed files with 9 additions and 10 deletions

View 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)

View 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, '/');

View 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;