aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/config.cpp')
-rw-r--r--src/zenserver/config.cpp120
1 files changed, 62 insertions, 58 deletions
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp
index 6c2bf40d8..0108e8b9f 100644
--- a/src/zenserver/config.cpp
+++ b/src/zenserver/config.cpp
@@ -18,6 +18,7 @@
ZEN_THIRD_PARTY_INCLUDES_START
#include <fmt/format.h>
+#include <fmt/ranges.h>
#include <zencore/logging.h>
#include <cxxopts.hpp>
#include <sol/sol.hpp>
@@ -26,61 +27,12 @@ ZEN_THIRD_PARTY_INCLUDES_END
#if ZEN_PLATFORM_WINDOWS
# include <conio.h>
#else
-# include <pwd.h>
# include <unistd.h>
#endif
#include <unordered_map>
#include <unordered_set>
-#if ZEN_PLATFORM_WINDOWS
-
-# include <zencore/windows.h>
-
-// Used for getting My Documents for default data directory
-# include <ShlObj.h>
-# pragma comment(lib, "shell32.lib")
-# pragma comment(lib, "ole32.lib")
-
-namespace zen {
-
-std::filesystem::path
-PickDefaultSystemRootDirectory()
-{
- // Pick sensible default
- PWSTR ProgramDataDir = nullptr;
- HRESULT hRes = SHGetKnownFolderPath(FOLDERID_ProgramData, 0, NULL, &ProgramDataDir);
-
- if (SUCCEEDED(hRes))
- {
- std::filesystem::path FinalPath(ProgramDataDir);
- FinalPath /= L"Epic\\Zen";
- ::CoTaskMemFree(ProgramDataDir);
-
- return FinalPath;
- }
-
- return L"";
-}
-
-} // namespace zen
-
-#else
-
-namespace zen {
-
-std::filesystem::path
-PickDefaultSystemRootDirectory()
-{
- int UserId = getuid();
- const passwd* Passwd = getpwuid(UserId);
- return std::filesystem::path(Passwd->pw_dir) / ".zen";
-}
-
-} // namespace zen
-
-#endif
-
namespace zen {
std::filesystem::path
@@ -165,6 +117,16 @@ ValidateOptions(ZenServerOptions& ServerOptions)
{
throw zen::OptionParseException("Dedicated server can not be used with forced local server address");
}
+ if (ServerOptions.GcConfig.AttachmentPassCount > ZenGcConfig::GcMaxAttachmentPassCount)
+ {
+ throw zen::OptionParseException(
+ fmt::format("GC attachment pass count can not be larger than {}", ZenGcConfig::GcMaxAttachmentPassCount));
+ }
+ if (ServerOptions.GcConfig.UseGCV2 == false)
+ {
+ ZEN_WARN("--gc-v2=false is deprecated, reverting to --gc-v2=true");
+ ServerOptions.GcConfig.UseGCV2 = true;
+ }
}
UpstreamCachePolicy
@@ -518,12 +480,12 @@ ParseConfigFile(const std::filesystem::path& Path,
"gc-compactblock-threshold"sv);
LuaOptions.AddOption("gc.verbose"sv, ServerOptions.GcConfig.Verbose, "gc-verbose"sv);
LuaOptions.AddOption("gc.single-threaded"sv, ServerOptions.GcConfig.SingleThreaded, "gc-single-threaded"sv);
- LuaOptions.AddOption("gc.cache.attachment.store"sv,
- ServerOptions.StructuredCacheConfig.StoreAttachmentMetaData,
- "gc-cache-attachment-store");
+ LuaOptions.AddOption("gc.cache.attachment.store"sv, ServerOptions.GcConfig.StoreCacheAttachmentMetaData, "gc-cache-attachment-store");
LuaOptions.AddOption("gc.projectstore.attachment.store"sv,
- ServerOptions.ProjectStoreConfig.StoreAttachmentMetaData,
+ ServerOptions.GcConfig.StoreProjectAttachmentMetaData,
"gc-projectstore-attachment-store");
+ LuaOptions.AddOption("gc.attachment.passes"sv, ServerOptions.GcConfig.AttachmentPassCount, "gc-attachment-passes"sv);
+ LuaOptions.AddOption("gc.validation"sv, ServerOptions.GcConfig.EnableValidation, "gc-validation");
////// gc
LuaOptions.AddOption("gc.cache.maxdurationseconds"sv, ServerOptions.GcConfig.Cache.MaxDurationSeconds, "gc-cache-duration-seconds"sv);
@@ -537,6 +499,9 @@ ParseConfigFile(const std::filesystem::path& Path,
////// workspaces
LuaOptions.AddOption("workspaces.enabled"sv, ServerOptions.WorksSpacesConfig.Enabled, "workspaces-enabled"sv);
+ LuaOptions.AddOption("workspaces.allowconfigchanges"sv,
+ ServerOptions.WorksSpacesConfig.AllowConfigurationChanges,
+ "workspaces-allow-changes"sv);
// These have special command line processing so we make sure we export them if they were configured on command line
if (!ServerOptions.AuthConfig.OpenIdProviders.empty())
@@ -571,7 +536,15 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
}
#endif
- ServerOptions.CommandLine = fmt::format("{}", fmt::join(std::span<const char*>((const char**)argv, size_t(argc)), " "));
+ for (int i = 0; i < argc; ++i)
+ {
+ if (i)
+ {
+ ServerOptions.CommandLine.push_back(' ');
+ }
+
+ ServerOptions.CommandLine += argv[i];
+ }
// Note to those adding future options; std::filesystem::path-type options
// must be read into a std::string first. As of cxxopts-3.0.0 it uses a >>
@@ -620,6 +593,9 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
options.add_options()("detach",
"Indicate whether zenserver should detach from parent process group",
cxxopts::value<bool>(ServerOptions.Detach)->default_value("true"));
+ options.add_options()("malloc",
+ "Configure memory allocator subsystem",
+ cxxopts::value(ServerOptions.MemoryOptions)->default_value("mimalloc"));
// clang-format off
options.add_options("logging")
@@ -740,6 +716,13 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
#if ZEN_WITH_TRACE
options.add_option("ue-trace",
"",
+ "trace",
+ "Specify which trace channels should be enabled",
+ cxxopts::value<std::string>(ServerOptions.TraceChannels)->default_value(""),
+ "");
+
+ options.add_option("ue-trace",
+ "",
"tracehost",
"Hostname to send the trace to",
cxxopts::value<std::string>(ServerOptions.TraceHost)->default_value(""),
@@ -906,14 +889,21 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
"",
"gc-cache-attachment-store",
"Enable storing attachments referenced by a cache record in block store meta data.",
- cxxopts::value<bool>(ServerOptions.StructuredCacheConfig.StoreAttachmentMetaData)->default_value("false"),
+ cxxopts::value<bool>(ServerOptions.GcConfig.StoreCacheAttachmentMetaData)->default_value("false"),
"");
options.add_option("gc",
"",
"gc-projectstore-attachment-store",
"Enable storing attachments referenced by project oplogs in meta data.",
- cxxopts::value<bool>(ServerOptions.ProjectStoreConfig.StoreAttachmentMetaData)->default_value("false"),
+ cxxopts::value<bool>(ServerOptions.GcConfig.StoreProjectAttachmentMetaData)->default_value("false"),
+ "");
+
+ options.add_option("gc",
+ "",
+ "gc-validation",
+ "Enable validation of references after full GC.",
+ cxxopts::value<bool>(ServerOptions.GcConfig.EnableValidation)->default_value("true"),
"");
options.add_option("gc",
@@ -1015,6 +1005,14 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
cxxopts::value<bool>(ServerOptions.GcConfig.SingleThreaded)->default_value("false"),
"");
+ options.add_option("gc",
+ "",
+ "gc-attachment-passes",
+ "Limit the range of unreferenced attachments included in GC check by breaking it into passes. Default is one pass "
+ "which includes all the attachments.",
+ cxxopts::value<uint16_t>(ServerOptions.GcConfig.AttachmentPassCount)->default_value("1"),
+ "");
+
options.add_option("objectstore",
"",
"objectstore-enabled",
@@ -1037,13 +1035,19 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
cxxopts::value<bool>(ServerOptions.StatsConfig.Enabled)->default_value("false"),
"Enable statsd reporter (localhost:8125)");
- options.add_option("stats",
+ options.add_option("workspaces",
"",
"workspaces-enabled",
"",
- cxxopts::value<bool>(ServerOptions.WorksSpacesConfig.Enabled)->default_value("false"),
+ cxxopts::value<bool>(ServerOptions.WorksSpacesConfig.Enabled)->default_value("true"),
"Enable workspaces support with folder sharing");
+ options.add_option("workspaces",
+ "",
+ "workspaces-allow-changes",
+ "",
+ cxxopts::value<bool>(ServerOptions.WorksSpacesConfig.AllowConfigurationChanges)->default_value("false"),
+ "Allow adding/modifying/deleting of workspace and shares via http endpoint");
try
{
cxxopts::ParseResult Result;