aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
blob: 9fd4bfa69df700bdc2cdb569cfdb1e575c86e0bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
// Copyright Epic Games, Inc. All Rights Reserved.

#include "config.h"

#include "diag/logging.h"

#include <zencore/fmtutils.h>
#include <zencore/iobuffer.h>
#include <zencore/string.h>
#include <zenhttp/zenhttp.h>

ZEN_THIRD_PARTY_INCLUDES_START
#include <fmt/format.h>
#include <zencore/logging.h>
#include <cxxopts.hpp>
#include <sol/sol.hpp>
ZEN_THIRD_PARTY_INCLUDES_END

#if ZEN_PLATFORM_WINDOWS
#	include <conio.h>
#else
#	include <pwd.h>
#endif

#if ZEN_PLATFORM_WINDOWS

// Used for getting My Documents for default data directory
#	include <ShlObj.h>
#	pragma comment(lib, "shell32.lib")

std::filesystem::path
PickDefaultStateDirectory()
{
	// Pick sensible default

	WCHAR	myDocumentsDir[MAX_PATH];
	HRESULT hRes = SHGetFolderPathW(NULL,
									CSIDL_PERSONAL /*  My Documents */,
									NULL,
									SHGFP_TYPE_CURRENT,
									/* out */ myDocumentsDir);

	if (SUCCEEDED(hRes))
	{
		wcscat_s(myDocumentsDir, L"\\zen");

		return myDocumentsDir;
	}

	int			   CandidateDriveLetterOffset = -1;
	ULARGE_INTEGER CandidateDriveSize;
	CandidateDriveSize.QuadPart = 0L;
	DWORD LogicalDrives			= GetLogicalDrives();
	char  CandidateDriveName[]	= "A:\\";
	for (int DriveLetterOffset = 0; DriveLetterOffset < 32; ++DriveLetterOffset)
	{
		if ((LogicalDrives & (1 << DriveLetterOffset)) != 0)
		{
			CandidateDriveName[0] = (char)('A' + DriveLetterOffset);
			if (GetDriveTypeA(CandidateDriveName) == DRIVE_FIXED)
			{
				ULARGE_INTEGER FreeBytesAvailableToCaller;
				ULARGE_INTEGER TotalNumberOfBytes;
				if (0 != GetDiskFreeSpaceExA(CandidateDriveName, &FreeBytesAvailableToCaller, &TotalNumberOfBytes, nullptr))
				{
					if ((FreeBytesAvailableToCaller.QuadPart > 0) && (TotalNumberOfBytes.QuadPart > CandidateDriveSize.QuadPart))
					{
						CandidateDriveLetterOffset = DriveLetterOffset;
						CandidateDriveSize		   = TotalNumberOfBytes;
					}
				}
			}
		}
	}

	if (CandidateDriveLetterOffset >= 0)
	{
		char RootZenFolderName[] = "A:\\zen";
		RootZenFolderName[0]	 = (char)('A' + CandidateDriveLetterOffset);
		return RootZenFolderName;
	}

	return L"";
}

#else

std::filesystem::path
PickDefaultStateDirectory()
{
	int			  UserId = getuid();
	const passwd* Passwd = getpwuid(UserId);
	return std::filesystem::path(Passwd->pw_dir) / ".zen";
}

#endif

UpstreamCachePolicy
ParseUpstreamCachePolicy(std::string_view Options)
{
	if (Options == "readonly")
	{
		return UpstreamCachePolicy::Read;
	}
	else if (Options == "writeonly")
	{
		return UpstreamCachePolicy::Write;
	}
	else if (Options == "disabled")
	{
		return UpstreamCachePolicy::Disabled;
	}
	else
	{
		return UpstreamCachePolicy::ReadWrite;
	}
}

void ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptions);

void
ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
{
#if ZEN_WITH_HTTPSYS
	const char* DefaultHttp = "httpsys";
#else
	const char* DefaultHttp = "asio";
#endif

	cxxopts::Options options("zenserver", "Zen Server");
	options.add_options()("dedicated",
						  "Enable dedicated server mode",
						  cxxopts::value<bool>(ServerOptions.IsDedicated)->default_value("false"));
	options.add_options()("d, debug", "Enable debugging", cxxopts::value<bool>(ServerOptions.IsDebug)->default_value("false"));
	options.add_options()("help", "Show command line help");
	options.add_options()("t, test", "Enable test mode", cxxopts::value<bool>(ServerOptions.IsTest)->default_value("false"));
	options.add_options()("log-id", "Specify id for adding context to log output", cxxopts::value<std::string>(ServerOptions.LogId));
	options.add_options()("data-dir", "Specify persistence root", cxxopts::value<std::filesystem::path>(ServerOptions.DataDir));
	options.add_options()("content-dir", "Frontend content directory", cxxopts::value<std::filesystem::path>(ServerOptions.ContentDir));
	options.add_options()("abslog", "Path to log file", cxxopts::value<std::filesystem::path>(ServerOptions.AbsLogFile));
	options.add_options()("config", "Path to Lua config file", cxxopts::value<std::filesystem::path>(ServerOptions.ConfigFile));

	options
		.add_option("lifetime", "", "owner-pid", "Specify owning process id", cxxopts::value<int>(ServerOptions.OwnerPid), "<identifier>");
	options.add_option("lifetime",
					   "",
					   "child-id",
					   "Specify id which can be used to signal parent",
					   cxxopts::value<std::string>(ServerOptions.ChildId),
					   "<identifier>");

#if ZEN_PLATFORM_WINDOWS
	options.add_option("lifetime",
					   "",
					   "install",
					   "Install zenserver as a Windows service",
					   cxxopts::value<bool>(ServerOptions.InstallService),
					   "");
	options.add_option("lifetime",
					   "",
					   "uninstall",
					   "Uninstall zenserver as a Windows service",
					   cxxopts::value<bool>(ServerOptions.UninstallService),
					   "");
#endif

	options.add_option("network",
					   "",
					   "http",
					   "Select HTTP server implementation (asio|httpsys|null)",
					   cxxopts::value<std::string>(ServerOptions.HttpServerClass)->default_value(DefaultHttp),
					   "<http class>");

	options.add_option("network",
					   "p",
					   "port",
					   "Select HTTP port",
					   cxxopts::value<int>(ServerOptions.BasePort)->default_value("1337"),
					   "<port number>");

#if ZEN_ENABLE_MESH
	options.add_option("network",
					   "m",
					   "mesh",
					   "Enable mesh network",
					   cxxopts::value<bool>(ServerOptions.MeshEnabled)->default_value("false"),
					   "");
#endif

#if ZEN_WITH_TRACE
	options.add_option("ue-trace",
					   "",
					   "tracehost",
					   "Hostname to send the trace to",
					   cxxopts::value<std::string>(ServerOptions.TraceHost)->default_value(""),
					   "");

	options.add_option("ue-trace",
					   "",
					   "tracefile",
					   "Path to write a trace to",
					   cxxopts::value<std::string>(ServerOptions.TraceFile)->default_value(""),
					   "");
#endif	// ZEN_WITH_TRACE

	options.add_option("diagnostics",
					   "",
					   "crash",
					   "Simulate a crash",
					   cxxopts::value<bool>(ServerOptions.ShouldCrash)->default_value("false"),
					   "");

	std::string UpstreamCachePolicyOptions;
	options.add_option("cache",
					   "",
					   "upstream-cache-policy",
					   "",
					   cxxopts::value<std::string>(UpstreamCachePolicyOptions)->default_value(""),
					   "Upstream cache policy (readwrite|readonly|writeonly|disabled)");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-url",
					   "URL to a Jupiter instance",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.Url)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-oauth-url",
					   "URL to the OAuth provier",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthProvider)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-oauth-clientid",
					   "The OAuth client ID",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthClientId)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-oauth-clientsecret",
					   "The OAuth client secret",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthClientSecret)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-namespace",
					   "The Common Blob Store API namespace",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.Namespace)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-namespace-ddc",
					   "The lecacy DDC namespace",
					   cxxopts::value<std::string>(ServerOptions.UpstreamCacheConfig.JupiterConfig.DdcNamespace)->default_value(""),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-prod",
					   "Enable Jupiter upstream caching using production settings",
					   cxxopts::value<bool>(ServerOptions.UpstreamCacheConfig.JupiterConfig.UseProductionSettings)->default_value("false"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-dev",
					   "Enable Jupiter upstream caching using development settings",
					   cxxopts::value<bool>(ServerOptions.UpstreamCacheConfig.JupiterConfig.UseDevelopmentSettings)->default_value("false"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-jupiter-use-legacy-ddc",
					   "Whether to store derived data using the legacy endpoint",
					   cxxopts::value<bool>(ServerOptions.UpstreamCacheConfig.JupiterConfig.UseLegacyDdc)->default_value("false"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-zen-url",
					   "URL to remote Zen server. Use a comma separated list to choose the one with the best latency.",
					   cxxopts::value<std::vector<std::string>>(ServerOptions.UpstreamCacheConfig.ZenConfig.Urls),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-zen-dns",
					   "DNS that resolves to one or more Zen server instance(s)",
					   cxxopts::value<std::vector<std::string>>(ServerOptions.UpstreamCacheConfig.ZenConfig.Dns),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-thread-count",
					   "Number of threads used for upstream procsssing",
					   cxxopts::value<int32_t>(ServerOptions.UpstreamCacheConfig.UpstreamThreadCount)->default_value("4"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-stats",
					   "Collect performance metrics for upstream endpoints",
					   cxxopts::value<bool>(ServerOptions.UpstreamCacheConfig.StatsEnabled)->default_value("false"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-connect-timeout-ms",
					   "Connect timeout in millisecond(s). Default 5000 ms.",
					   cxxopts::value<int32_t>(ServerOptions.UpstreamCacheConfig.ConnectTimeoutMilliseconds)->default_value("5000"),
					   "");

	options.add_option("cache",
					   "",
					   "upstream-timeout-ms",
					   "Timeout in millisecond(s). Default 0 ms",
					   cxxopts::value<int32_t>(ServerOptions.UpstreamCacheConfig.TimeoutMilliseconds)->default_value("0"),
					   "");

	options.add_option("gc",
					   "",
					   "gc-enabled",
					   "Whether garbage collection is enabled or not.",
					   cxxopts::value<bool>(ServerOptions.GcConfig.Enabled)->default_value("true"),
					   "");

	options.add_option("gc",
					   "",
					   "gc-small-objects",
					   "Whether garbage collection is enabled or not.",
					   cxxopts::value<bool>(ServerOptions.GcConfig.CollectSmallObjects)->default_value("true"),
					   "");

	options.add_option("gc",
					   "",
					   "gc-interval-seconds",
					   "Garbage collection interval in seconds. Default set to 0 (Off).",
					   cxxopts::value<int32_t>(ServerOptions.GcConfig.IntervalSeconds)->default_value("0"),
					   "");

	options.add_option("gc",
					   "",
					   "gc-cache-duration-seconds",
					   "Max duration in seconds before Z$ entries get evicted.",
					   cxxopts::value<int32_t>(ServerOptions.GcConfig.Cache.MaxDurationSeconds)->default_value("86400"),
					   "");
	try
	{
		auto result = options.parse(argc, argv);

		if (result.count("help"))
		{
			zen::logging::ConsoleLog().info("{}", options.help());
#if ZEN_PLATFORM_WINDOWS
			zen::logging::ConsoleLog().info("Press any key to exit!");
			_getch();
#else
			// Assume the user's in a terminal on all other platforms and that
			// they'll use less/more/etc. if need be.
#endif
			exit(0);
		}

		ServerOptions.UpstreamCacheConfig.CachePolicy = ParseUpstreamCachePolicy(UpstreamCachePolicyOptions);

		if (!ServerOptions.ConfigFile.empty())
		{
			ParseConfigFile(ServerOptions.ConfigFile, ServerOptions);
		}
		else
		{
			ParseConfigFile(ServerOptions.DataDir / "zen_cfg.lua", ServerOptions);
		}
	}
	catch (cxxopts::OptionParseException& e)
	{
		zen::logging::ConsoleLog().error("Error parsing zenserver arguments: {}\n\n{}", e.what(), options.help());

		throw;
	}

	if (ServerOptions.DataDir.empty())
	{
		ServerOptions.DataDir = PickDefaultStateDirectory();
	}
}

void
ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptions)
{
	zen::IoBuffer LuaScript = zen::IoBufferBuilder::MakeFromFile(Path);

	if (LuaScript)
	{
		sol::state lua;

		lua.open_libraries(sol::lib::base);

		lua.set_function("getenv", [&](const std::string env) -> sol::object {
#if ZEN_PLATFORM_WINDOWS
			std::wstring EnvVarValue;
			size_t		 RequiredSize = 0;
			std::wstring EnvWide	  = zen::Utf8ToWide(env);
			_wgetenv_s(&RequiredSize, nullptr, 0, EnvWide.c_str());

			if (RequiredSize == 0)
				return sol::make_object(lua, sol::lua_nil);

			EnvVarValue.resize(RequiredSize);
			_wgetenv_s(&RequiredSize, EnvVarValue.data(), RequiredSize, EnvWide.c_str());
			return sol::make_object(lua, zen::WideToUtf8(EnvVarValue.c_str()));
#else
			ZEN_UNUSED(env);
			return sol::make_object(lua, sol::lua_nil);
#endif
		});

		try
		{
			sol::load_result config = lua.load(std::string_view((const char*)LuaScript.Data(), LuaScript.Size()), "zen_cfg");

			if (!config.valid())
			{
				sol::error err = config;

				std::string ErrorString = sol::to_string(config.status());

				throw std::runtime_error(fmt::format("{} error: {}", ErrorString, err.what()));
			}

			config();
		}
		catch (std::exception& e)
		{
			throw std::runtime_error(fmt::format("failed to load config script ('{}'): {}", Path, e.what()).c_str());
		}

		if (sol::optional<sol::table> ServerConfig = lua["server"])
		{
			if (ServerOptions.DataDir.empty())
			{
				if (sol::optional<std::string> Opt = ServerConfig.value()["datadir"])
				{
					ServerOptions.DataDir = Opt.value();
				}
			}

			if (ServerOptions.ContentDir.empty())
			{
				if (sol::optional<std::string> Opt = ServerConfig.value()["contentdir"])
				{
					ServerOptions.ContentDir = Opt.value();
				}
			}

			if (ServerOptions.AbsLogFile.empty())
			{
				if (sol::optional<std::string> Opt = ServerConfig.value()["abslog"])
				{
					ServerOptions.AbsLogFile = Opt.value();
				}
			}

			ServerOptions.IsDebug = ServerConfig->get_or("debug", ServerOptions.IsDebug);
		}

		if (sol::optional<sol::table> NetworkConfig = lua["network"])
		{
			if (sol::optional<std::string> Opt = NetworkConfig.value()["httpserverclass"])
			{
				ServerOptions.HttpServerClass = Opt.value();
			}

			ServerOptions.BasePort = NetworkConfig->get_or<int>("port", ServerOptions.BasePort);
#if ZEN_ENABLE_MESH
			ServerOptions.MeshEnabled = NetworkConfig->get_or<bool>("meshenabled", ServerOptions.MeshEnabled);
#endif
		}

		auto UpdateStringValueFromConfig = [](const sol::table& Table, std::string_view Key, std::string& OutValue) {
			// Update the specified config value unless it has been set, i.e. from command line
			if (auto MaybeValue = Table.get<sol::optional<std::string>>(Key); MaybeValue.has_value() && OutValue.empty())
			{
				OutValue = MaybeValue.value();
			}
		};

		if (sol::optional<sol::table> StructuredCacheConfig = lua["cache"])
		{
			ServerOptions.StructuredCacheEnabled = StructuredCacheConfig->get_or("enable", ServerOptions.StructuredCacheEnabled);

			if (auto UpstreamConfig = StructuredCacheConfig->get<sol::optional<sol::table>>("upstream"))
			{
				std::string Policy							  = UpstreamConfig->get_or("policy", std::string());
				ServerOptions.UpstreamCacheConfig.CachePolicy = ParseUpstreamCachePolicy(Policy);
				ServerOptions.UpstreamCacheConfig.UpstreamThreadCount =
					UpstreamConfig->get_or("upstreamthreadcount", ServerOptions.UpstreamCacheConfig.UpstreamThreadCount);

				if (auto JupiterConfig = UpstreamConfig->get<sol::optional<sol::table>>("jupiter"))
				{
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("url"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.Url);
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("oauthprovider"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthProvider);
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("oauthclientid"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthClientId);
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("oauthclientsecret"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.OAuthClientSecret);
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("namespace"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.Namespace);
					UpdateStringValueFromConfig(JupiterConfig.value(),
												std::string_view("ddcnamespace"),
												ServerOptions.UpstreamCacheConfig.JupiterConfig.DdcNamespace);

					ServerOptions.UpstreamCacheConfig.JupiterConfig.UseDevelopmentSettings =
						JupiterConfig->get_or("usedevelopmentsettings",
											  ServerOptions.UpstreamCacheConfig.JupiterConfig.UseDevelopmentSettings);

					ServerOptions.UpstreamCacheConfig.JupiterConfig.UseLegacyDdc =
						JupiterConfig->get_or("uselegacyddc", ServerOptions.UpstreamCacheConfig.JupiterConfig.UseLegacyDdc);
				};

				if (auto ZenConfig = UpstreamConfig->get<sol::optional<sol::table>>("zen"))
				{
					if (auto Url = ZenConfig.value().get<sol::optional<std::string>>("url"))
					{
						ServerOptions.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())
						{
							ServerOptions.UpstreamCacheConfig.ZenConfig.Urls.push_back(Kv.second.as<std::string>());
						}
					}

					if (auto Dns = ZenConfig.value().get<sol::optional<std::string>>("dns"))
					{
						ServerOptions.UpstreamCacheConfig.ZenConfig.Dns.push_back(Dns.value());
					}
					else if (auto DnsArray = ZenConfig.value().get<sol::optional<sol::table>>("dns"))
					{
						for (const auto& Kv : DnsArray.value())
						{
							ServerOptions.UpstreamCacheConfig.ZenConfig.Dns.push_back(Kv.second.as<std::string>());
						}
					}
				}
			}
		}

		if (sol::optional<sol::table> GcConfig = lua["gc"])
		{
			ServerOptions.GcConfig.IntervalSeconds = GcConfig.value().get_or("intervalseconds", 0);

			if (sol::optional<sol::table> CacheGcConfig = GcConfig.value()["cache"])
			{
				ServerOptions.GcConfig.Cache.MaxDurationSeconds = CacheGcConfig.value().get_or("maxdurationseconds", int32_t(0));
				ServerOptions.GcConfig.Cache.DiskSizeLimit		= CacheGcConfig.value().get_or("disksizelimit", ~uint64_t(0));
				ServerOptions.GcConfig.Cache.MemorySizeLimit	= CacheGcConfig.value().get_or("memorysizelimit", ~uint64_t(0));
			}

			if (sol::optional<sol::table> CasGcConfig = GcConfig.value()["cas"])
			{
				ServerOptions.GcConfig.Cas.LargeStrategySizeLimit = CasGcConfig.value().get_or("largestrategysizelimit", ~uint64_t(0));
				ServerOptions.GcConfig.Cas.SmallStrategySizeLimit = CasGcConfig.value().get_or("smallstrategysizelimit", ~uint64_t(0));
				ServerOptions.GcConfig.Cas.TinyStrategySizeLimit  = CasGcConfig.value().get_or("tinystrategysizelimit", ~uint64_t(0));
			}
		}
	}
}