aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/config.h
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-02 10:01:47 +0200
committerGitHub <[email protected]>2023-05-02 10:01:47 +0200
commit075d17f8ada47e990fe94606c3d21df409223465 (patch)
treee50549b766a2f3c354798a54ff73404217b4c9af /src/zenserver/config.h
parentfix: bundle shouldn't append content zip to zen (diff)
downloadzen-075d17f8ada47e990fe94606c3d21df409223465.tar.xz
zen-075d17f8ada47e990fe94606c3d21df409223465.zip
moved source directories into `/src` (#264)
* moved source directories into `/src` * updated bundle.lua for new `src` path * moved some docs, icon * removed old test trees
Diffstat (limited to 'src/zenserver/config.h')
-rw-r--r--src/zenserver/config.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/zenserver/config.h b/src/zenserver/config.h
new file mode 100644
index 000000000..8a5c6de4e
--- /dev/null
+++ b/src/zenserver/config.h
@@ -0,0 +1,158 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include <zencore/zencore.h>
+#include <filesystem>
+#include <string>
+#include <vector>
+
+struct ZenUpstreamJupiterConfig
+{
+ std::string Name;
+ std::string Url;
+ std::string OAuthUrl;
+ std::string OAuthClientId;
+ std::string OAuthClientSecret;
+ std::string OpenIdProvider;
+ std::string AccessToken;
+ std::string Namespace;
+ std::string DdcNamespace;
+};
+
+struct ZenUpstreamHordeConfig
+{
+ std::string Name;
+ std::string Url;
+ std::string OAuthUrl;
+ std::string OAuthClientId;
+ std::string OAuthClientSecret;
+ std::string OpenIdProvider;
+ std::string AccessToken;
+
+ std::string StorageUrl;
+ std::string StorageOAuthUrl;
+ std::string StorageOAuthClientId;
+ std::string StorageOAuthClientSecret;
+ std::string StorageOpenIdProvider;
+ std::string StorageAccessToken;
+
+ std::string Cluster;
+ std::string Namespace;
+};
+
+struct ZenUpstreamZenConfig
+{
+ std::string Name;
+ std::vector<std::string> Urls;
+ std::vector<std::string> Dns;
+};
+
+enum class UpstreamCachePolicy : uint8_t
+{
+ Disabled = 0,
+ Read = 1 << 0,
+ Write = 1 << 1,
+ ReadWrite = Read | Write
+};
+
+struct ZenUpstreamCacheConfig
+{
+ ZenUpstreamJupiterConfig JupiterConfig;
+ ZenUpstreamHordeConfig HordeConfig;
+ ZenUpstreamZenConfig ZenConfig;
+ int32_t UpstreamThreadCount = 4;
+ int32_t ConnectTimeoutMilliseconds = 5000;
+ int32_t TimeoutMilliseconds = 0;
+ UpstreamCachePolicy CachePolicy = UpstreamCachePolicy::ReadWrite;
+};
+
+struct ZenCacheEvictionPolicy
+{
+ uint64_t DiskSizeLimit = ~uint64_t(0);
+ uint64_t MemorySizeLimit = 1024 * 1024 * 1024;
+ int32_t MaxDurationSeconds = 24 * 60 * 60;
+ uint64_t DiskSizeSoftLimit = 0;
+ bool Enabled = true;
+};
+
+struct ZenCasEvictionPolicy
+{
+ uint64_t LargeStrategySizeLimit = ~uint64_t(0);
+ uint64_t SmallStrategySizeLimit = ~uint64_t(0);
+ uint64_t TinyStrategySizeLimit = ~uint64_t(0);
+ bool Enabled = true;
+};
+
+struct ZenGcConfig
+{
+ ZenCasEvictionPolicy Cas;
+ ZenCacheEvictionPolicy Cache;
+ int32_t MonitorIntervalSeconds = 30;
+ int32_t IntervalSeconds = 0;
+ bool CollectSmallObjects = true;
+ bool Enabled = true;
+ uint64_t DiskReserveSize = 1ul << 28;
+};
+
+struct ZenOpenIdProviderConfig
+{
+ std::string Name;
+ std::string Url;
+ std::string ClientId;
+};
+
+struct ZenAuthConfig
+{
+ std::vector<ZenOpenIdProviderConfig> OpenIdProviders;
+};
+
+struct ZenObjectStoreConfig
+{
+ struct BucketConfig
+ {
+ std::string Name;
+ std::filesystem::path Directory;
+ };
+
+ std::vector<BucketConfig> Buckets;
+};
+
+struct ZenServerOptions
+{
+ ZenUpstreamCacheConfig UpstreamCacheConfig;
+ ZenGcConfig GcConfig;
+ ZenAuthConfig AuthConfig;
+ ZenObjectStoreConfig ObjectStoreConfig;
+ std::filesystem::path DataDir; // Root directory for state (used for testing)
+ std::filesystem::path ContentDir; // Root directory for serving frontend content (experimental)
+ std::filesystem::path AbsLogFile; // Absolute path to main log file
+ std::filesystem::path ConfigFile; // Path to Lua config file
+ std::string ChildId; // Id assigned by parent process (used for lifetime management)
+ std::string LogId; // Id for tagging log output
+ std::string HttpServerClass; // Choice of HTTP server implementation
+ std::string EncryptionKey; // 256 bit AES encryption key
+ std::string EncryptionIV; // 128 bit AES initialization vector
+ int BasePort = 1337; // Service listen port (used for both UDP and TCP)
+ int OwnerPid = 0; // Parent process id (zero for standalone)
+ int WebSocketPort = 0; // Web socket port (Zero = disabled)
+ int WebSocketThreads = 0;
+ bool InstallService = false; // Flag used to initiate service install (temporary)
+ bool UninstallService = false; // Flag used to initiate service uninstall (temporary)
+ bool IsDebug = false;
+ bool IsTest = false;
+ bool IsDedicated = false; // Indicates a dedicated/shared instance, with larger resource requirements
+ bool StructuredCacheEnabled = true;
+ bool ExecServiceEnabled = true;
+ bool ComputeServiceEnabled = true;
+ bool ShouldCrash = false; // Option for testing crash handling
+ bool IsFirstRun = false;
+ bool NoSentry = false;
+ bool ObjectStoreEnabled = false;
+#if ZEN_WITH_TRACE
+ std::string TraceHost; // Host name or IP address to send trace data to
+ std::string TraceFile; // Path of a file to write a trace
+#endif
+};
+
+void ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions);