}
};
+const char *rgw_conf_get(const map<string, string, ltstr_nocase>& conf_map, const char *name, const char *def_val);
+int rgw_conf_get_int(const map<string, string, ltstr_nocase>& conf_map, const char *name, int def_val);
+bool rgw_conf_get_bool(const map<string, string, ltstr_nocase>& conf_map, const char *name, bool def_val);
+
class RGWEnv;
class RGWConf {
init(cct);
}
-const char *RGWEnv::get(const char *name, const char *def_val)
+const char *rgw_conf_get(const map<string, string, ltstr_nocase>& conf_map, const char *name, const char *def_val)
{
- map<string, string, ltstr_nocase>::iterator iter = env_map.find(name);
- if (iter == env_map.end())
+ auto iter = conf_map.find(name);
+ if (iter == conf_map.end())
return def_val;
return iter->second.c_str();
}
-int RGWEnv::get_int(const char *name, int def_val)
+const char *RGWEnv::get(const char *name, const char *def_val)
{
- map<string, string, ltstr_nocase>::iterator iter = env_map.find(name);
- if (iter == env_map.end())
+ return rgw_conf_get(env_map, name, def_val);
+}
+
+int rgw_conf_get_int(const map<string, string, ltstr_nocase>& conf_map, const char *name, int def_val)
+{
+ auto iter = conf_map.find(name);
+ if (iter == conf_map.end())
return def_val;
const char *s = iter->second.c_str();
return atoi(s);
}
-bool RGWEnv::get_bool(const char *name, bool def_val)
+int RGWEnv::get_int(const char *name, int def_val)
{
- map<string, string, ltstr_nocase>::iterator iter = env_map.find(name);
- if (iter == env_map.end())
+ return rgw_conf_get_int(env_map, name, def_val);
+}
+
+bool rgw_conf_get_bool(const map<string, string, ltstr_nocase>& conf_map, const char *name, bool def_val)
+{
+ auto iter = conf_map.find(name);
+ if (iter == conf_map.end())
return def_val;
const char *s = iter->second.c_str();
return rgw_str_to_bool(s, def_val);
}
+bool RGWEnv::get_bool(const char *name, bool def_val)
+{
+ return rgw_conf_get_bool(env_map, name, def_val);
+}
+
size_t RGWEnv::get_size(const char *name, size_t def_val)
{
map<string, string, ltstr_nocase>::iterator iter = env_map.find(name);