aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-08-31 15:01:46 +0200
committerPer Larsson <[email protected]>2021-08-31 15:16:22 +0200
commitfd3946f2b2b013af01fdf60f67afb655c38c1901 (patch)
treeeca4abed5d71a157e185699f4e9668a92b756ca8 /zenserver/config.cpp
parentRemoved unused packages from vcpkg.json (diff)
downloadzen-fd3946f2b2b013af01fdf60f67afb655c38c1901.tar.xz
zen-fd3946f2b2b013af01fdf60f67afb655c38c1901.zip
Asynchronous upstream caching to Jupiter
Co-authored-by: Stefan Boberg <[email protected]>
Diffstat (limited to 'zenserver/config.cpp')
-rw-r--r--zenserver/config.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 6d725e55b..6e8b48703 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -95,6 +95,12 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z
cxxopts::value<bool>(ServiceConfig.ShouldCrash)->default_value("false"),
"");
+ options.add_option("cache",
+ "",
+ "enable-upstream-cache",
+ "Whether upstream caching is enabled",
+ cxxopts::value<bool>(ServiceConfig.UpstreamCacheEnabled)->default_value("false"),
+ "");
try
{
auto result = options.parse(argc, argv);
@@ -164,9 +170,11 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv
throw std::exception("fatal zen global config script ({}) failure: {}"_format(ConfigScript, e.what()).c_str());
}
- ServiceConfig.LegacyCacheEnabled = lua["legacycache"]["enable"];
- const std::string path = lua["legacycache"]["readpath"];
- ServiceConfig.StructuredCacheEnabled = lua["structuredcache"]["enable"];
- ServiceConfig.MeshEnabled = lua["mesh"]["enable"];
+
+ ServiceConfig.LegacyCacheEnabled = lua["legacycache"]["enable"].get_or(ServiceConfig.LegacyCacheEnabled);
+ const std::string path = lua["legacycache"]["readpath"].get_or(std::string());
+ ServiceConfig.StructuredCacheEnabled = lua["structuredcache"]["enable"].get_or(ServiceConfig.StructuredCacheEnabled);
+ ServiceConfig.MeshEnabled = lua["mesh"]["enable"].get_or(ServiceConfig.MeshEnabled);
+ ServiceConfig.UpstreamCacheEnabled = lua["structuredcache"]["upstream"]["enable"].get_or(ServiceConfig.UpstreamCacheEnabled);
}
}