aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-02 16:51:37 +0200
committerStefan Boberg <[email protected]>2021-10-02 16:51:37 +0200
commit56657a3a442ef94872304fa45a872bd54e740b20 (patch)
treebc31ec73949d2b3827858e2d0d4b744d524f6cc8 /zenserver/config.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-56657a3a442ef94872304fa45a872bd54e740b20.tar.xz
zen-56657a3a442ef94872304fa45a872bd54e740b20.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver/config.cpp')
-rw-r--r--zenserver/config.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 759534d58..7a1efe6e8 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -213,8 +213,8 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z
options.add_option("cache",
"",
"upstream-zen-url",
- "URL to a remote Zen server instance",
- cxxopts::value<std::string>(ServiceConfig.UpstreamCacheConfig.ZenConfig.Url)->default_value(""),
+ "URL to remote Zen server. Use a comma separated list to choose the one with the best latency.",
+ cxxopts::value<std::vector<std::string>>(ServiceConfig.UpstreamCacheConfig.ZenConfig.Urls)->default_value(""),
"");
options.add_option("cache",
@@ -367,9 +367,17 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv
if (auto ZenConfig = UpstreamConfig->get<sol::optional<sol::table>>("zen"))
{
- UpdateStringValueFromConfig(ZenConfig.value(),
- std::string_view("url"),
- ServiceConfig.UpstreamCacheConfig.ZenConfig.Url);
+ if (auto Url = ZenConfig.value().get<sol::optional<std::string>>("url"))
+ {
+ ServiceConfig.UpstreamCacheConfig.ZenConfig.Urls.push_back(Url.value());
+ }
+ else if (auto Urls = ZenConfig.value().get<sol::optional<sol::table>>("url"))
+ {
+ for (const auto& Kv : Urls.value())
+ {
+ ServiceConfig.UpstreamCacheConfig.ZenConfig.Urls.push_back(Kv.second.as<std::string>());
+ }
+ }
}
}
}