From 482da8abfabf075b03325213dd9ad0abb9a620e1 Mon Sep 17 00:00:00 2001 From: Rashesh Date: Fri, 23 Aug 2024 17:39:04 +0530 Subject: [PATCH] indirection: expose server_name when provided - this is useful for controller, collabora online vm setup - usually when running the collabora online in k8s environment we pass POD_NAME env variable. POD_NAME is needed as a env variable because on every restart POD_NAME changes that's not the case for COOL running in the vms - why don't use POD_NAME for VMs as well ? In container you only create one user and COOL process run under same user. If we set env variable in container it sets env varialble for that user only and COOL process can access it. For VMs, that's not the case we might have multiple users. so you need to set global env variable to make it. Instead of doing that I prefer providing the name inside coolwsd.xml Signed-off-by: Rashesh Change-Id: I92c204a0315c74ab121b5aa48795646b9dede39a --- coolwsd.xml.in | 1 + wsd/COOLWSD.cpp | 1 + wsd/ClientRequestDispatcher.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/coolwsd.xml.in b/coolwsd.xml.in index 0cc66fb67eee..9c5d59fc31eb 100644 --- a/coolwsd.xml.in +++ b/coolwsd.xml.in @@ -325,6 +325,7 @@ false + @LOCK_CONFIGURATION@ diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 21dd435a2c6e..1d4dcf3ac937 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -2193,6 +2193,7 @@ void COOLWSD::innerInitialize(Application& self) { "deepl.enabled", "false" }, { "zotero.enable", "true" }, { "indirection_endpoint.geolocation_setup.enable", "false" }, + { "indirection_endpoint.server_name", "" }, { "indirection_endpoint.url", "" }, #if !MOBILEAPP { "help_url", HELP_URL }, diff --git a/wsd/ClientRequestDispatcher.cpp b/wsd/ClientRequestDispatcher.cpp index 395e1d22eac0..744d2ef4249d 100644 --- a/wsd/ClientRequestDispatcher.cpp +++ b/wsd/ClientRequestDispatcher.cpp @@ -2058,8 +2058,11 @@ static std::string getCapabilitiesJson(bool convertToAvailable) capabilities->set("hasWASMSupport", COOLWSD::WASMState != COOLWSD::WASMActivationState::Disabled); + const std::string serverName = config::getString("indirection_endpoint.server_name", ""); if (const char* podName = std::getenv("POD_NAME")) capabilities->set("podName", podName); + else if (!serverName.empty()) + capabilities->set("podName", serverName); bool geoLocationSetup = config::getBool(std::string("indirection_endpoint.geolocation_setup.enable"), false);