diff options
| author | Dan Engelbrecht <[email protected]> | 2026-03-19 15:45:51 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-19 15:45:51 +0100 |
| commit | ef01289c1e0ca9426dae07b9c1a8f68a5549f738 (patch) | |
| tree | 63e200e70cc01171a053341bb2a6d364865f3368 /src/zenserver/hub/hydration.cpp | |
| parent | improve auth token refresh (#863) (diff) | |
| download | zen-ef01289c1e0ca9426dae07b9c1a8f68a5549f738.tar.xz zen-ef01289c1e0ca9426dae07b9c1a8f68a5549f738.zip | |
add --hub-hydration-target-spec to zen hub (#867)
Diffstat (limited to 'src/zenserver/hub/hydration.cpp')
| -rw-r--r-- | src/zenserver/hub/hydration.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/zenserver/hub/hydration.cpp b/src/zenserver/hub/hydration.cpp index 0e78f8545..e56be3934 100644 --- a/src/zenserver/hub/hydration.cpp +++ b/src/zenserver/hub/hydration.cpp @@ -10,6 +10,8 @@ namespace zen { /////////////////////////////////////////////////////////////////////////// +constexpr std::string_view FileHydratorPrefix = "file://"; + struct FileHydrator : public HydrationStrategyBase { virtual void Configure(const HydrationConfig& Config) override; @@ -26,7 +28,8 @@ FileHydrator::Configure(const HydrationConfig& Config) { m_Config = Config; - std::filesystem::path ConfigPath(Utf8ToWide(m_Config.TargetSpecification)); + std::filesystem::path ConfigPath(Utf8ToWide(m_Config.TargetSpecification.substr(FileHydratorPrefix.length()))); + MakeSafeAbsolutePathInPlace(ConfigPath); if (!std::filesystem::exists(ConfigPath)) { @@ -112,9 +115,15 @@ FileHydrator::Dehydrate() } std::unique_ptr<HydrationStrategyBase> -CreateFileHydrator() +CreateHydrator(const HydrationConfig& Config) { - return std::make_unique<FileHydrator>(); + if (StrCaseCompare(Config.TargetSpecification.substr(0, FileHydratorPrefix.length()), FileHydratorPrefix) == 0) + { + std::unique_ptr<HydrationStrategyBase> Hydrator = std::make_unique<FileHydrator>(); + Hydrator->Configure(Config); + return Hydrator; + } + throw std::runtime_error(fmt::format("Unknown hydration strategy: {}", Config.TargetSpecification)); } } // namespace zen |