aboutsummaryrefslogtreecommitdiff
path: root/zenutil
diff options
context:
space:
mode:
Diffstat (limited to 'zenutil')
-rw-r--r--zenutil/include/zenserverprocess.h3
-rw-r--r--zenutil/zenserverprocess.cpp11
2 files changed, 14 insertions, 0 deletions
diff --git a/zenutil/include/zenserverprocess.h b/zenutil/include/zenserverprocess.h
index d0093537e..f7d911a87 100644
--- a/zenutil/include/zenserverprocess.h
+++ b/zenutil/include/zenserverprocess.h
@@ -55,6 +55,8 @@ struct ZenServerInstance
void AttachToRunningServer(int BasePort = 0);
+ std::string GetBaseUri() const;
+
private:
ZenServerEnvironment& m_Env;
zen::ProcessHandle m_Process;
@@ -63,6 +65,7 @@ private:
bool m_Terminate = false;
std::filesystem::path m_TestDir;
bool m_MeshEnabled = false;
+ int m_BasePort = 0;
void CreateShutdownEvent(int BasePort);
};
diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp
index 4e45ddfae..8bbae426a 100644
--- a/zenutil/zenserverprocess.cpp
+++ b/zenutil/zenserverprocess.cpp
@@ -403,6 +403,7 @@ ZenServerInstance::SpawnServer(int BasePort)
if (BasePort)
{
CommandLine << " --port " << BasePort;
+ m_BasePort = BasePort;
}
if (!m_TestDir.empty())
@@ -558,3 +559,13 @@ ZenServerInstance::WaitUntilReady(int Timeout)
{
return m_ReadyEvent.Wait(Timeout);
}
+
+std::string
+ZenServerInstance::GetBaseUri() const
+{
+ ZEN_ASSERT(m_BasePort);
+
+ using namespace fmt::literals;
+
+ return "http://localhost:{}"_format(m_BasePort);
+}