Skip to content

Commit

Permalink
indirection: expose server_name when provided
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Change-Id: I92c204a0315c74ab121b5aa48795646b9dede39a
  • Loading branch information
Rash419 committed Aug 23, 2024
1 parent 249c9af commit 275bb95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions coolwsd.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
<geolocation_setup>
<enable desc="Enable geolocation_setup when using indirection server with geolocation configuration" type="bool" default="false">false</enable>
</geolocation_setup>
<server_name desc="server name to show in cluster overview admin panel"></server_name>
</indirection_endpoint>

@LOCK_CONFIGURATION@
Expand Down
1 change: 1 addition & 0 deletions wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
3 changes: 3 additions & 0 deletions wsd/ClientRequestDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 275bb95

Please sign in to comment.