summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/config.cpp
diff options
context:
space:
mode:
authorngc224 <[email protected]>2025-06-13 16:17:14 +0300
committerngc224 <[email protected]>2025-06-13 16:43:25 +0300
commit5af77c069f798dda36e69d1628c12252a5117702 (patch)
tree9c420e49ea050d7ab14a7213e3ce2e3d2e853726 /yt/cpp/mapreduce/interface/config.cpp
parentef58752c7f51af2aea1b49df35e4d71f56db95ef (diff)
Allow passing ProxyUrlAliasingRules to clients directly
commit_hash:5493d9ed32b24050fa5feb08fe13097302ca0a23
Diffstat (limited to 'yt/cpp/mapreduce/interface/config.cpp')
-rw-r--r--yt/cpp/mapreduce/interface/config.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/interface/config.cpp b/yt/cpp/mapreduce/interface/config.cpp
index cdabeaf3240..901f59fc215 100644
--- a/yt/cpp/mapreduce/interface/config.cpp
+++ b/yt/cpp/mapreduce/interface/config.cpp
@@ -190,6 +190,30 @@ void TConfig::LoadTimings()
HostListUpdateInterval = TDuration::Seconds(60);
}
+void TConfig::LoadProxyUrlAliasingRules()
+{
+ TString strConfig = GetEnv("YT_PROXY_URL_ALIASING_CONFIG");
+ if (!strConfig) {
+ return;
+ }
+
+ NYT::TNode nodeConfig;
+
+ try {
+ nodeConfig = NodeFromYsonString(strConfig);
+ Y_ENSURE(nodeConfig.IsMap());
+ } catch (const yexception& exc) {
+ ythrow yexception()
+ << "Failed to parse YT_PROXY_URL_ALIASING_CONFIG (it must be yson map): "
+ << exc;
+ }
+
+ for (const auto& [key, value] : nodeConfig.AsMap()) {
+ Y_ENSURE(value.IsString(), "Proxy url is not string");
+ ProxyUrlAliasingRules.emplace(key, value.AsString());
+ }
+}
+
void TConfig::Reset()
{
Hosts = GetEnv("YT_HOSTS", DefaultHosts);
@@ -219,6 +243,7 @@ void TConfig::Reset()
LoadToken();
LoadSpec();
LoadTimings();
+ LoadProxyUrlAliasingRules();
CacheUploadDeduplicationMode = GetUploadingDeduplicationMode("YT_UPLOAD_DEDUPLICATION", EUploadDeduplicationMode::Host);
CacheUploadDeduplicationThreshold = 10_MB;