Add configurable scheme hook

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-20 08:12:46 +08:00
parent baa0f6e7e7
commit d98f16070e
5 changed files with 43 additions and 15 deletions
+10
View File
@@ -60,6 +60,13 @@ namespace config {
}
out = normalize_base_url(document[key].GetString());
}
void read_bool(const rapidjson::Document& document, const char* key, bool& out) {
if (!document.HasMember(key) || !document[key].IsBool()) {
return;
}
out = document[key].GetBool();
}
}
void load() {
@@ -88,9 +95,12 @@ namespace config {
return;
}
read_bool(document, "force_http", g_urls.force_http);
read_string(document, "api_url", g_urls.api_url);
read_string(document, "asset_url", g_urls.asset_url);
hook_logf("[cgss-http-hook] force_http=%s", g_urls.force_http ? "true" : "false");
if (!g_urls.api_url.empty()) {
hook_logf("[cgss-http-hook] normalized api_url=%s", g_urls.api_url.c_str());
}