aboutsummaryrefslogtreecommitdiff
path: root/zenutil
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-08 19:28:59 +0200
committerStefan Boberg <[email protected]>2021-09-08 19:28:59 +0200
commitce4276a783c437148400c79a0276ce2df58b4bf8 (patch)
treedb5a85ddfc34149317925ce4b996246095427b38 /zenutil
parentLogging vcxproj changes (diff)
downloadzen-ce4276a783c437148400c79a0276ce2df58b4bf8.tar.xz
zen-ce4276a783c437148400c79a0276ce2df58b4bf8.zip
Adding ZenServerInstance::GetBaseUri()
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);
+}