[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/loolwsd.xml

Jan Holesovsky kendy at collabora.com
Thu Apr 14 09:14:19 UTC 2016


 loolwsd/LOOLWSD.cpp |   10 +++++++++-
 loolwsd/LOOLWSD.hpp |    1 +
 loolwsd/loolwsd.xml |    3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 7d645014792fcfe26caa564941ecbe9da44507c1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Apr 14 11:13:30 2016 +0200

    Allow setting the server name and port in loolwsd.xml.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index e53906b..b4d4fe8 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -647,7 +647,9 @@ private:
         const std::string mediaType = "text/xml";
         const std::string action = "action";
         const std::string urlsrc = "urlsrc";
-        const std::string uriValue = (LOOLWSD::SSLEnabled? "https://": "http://") + request.getHost() + "/loleaflet/dist/loleaflet.html?";
+        const std::string uriValue = (LOOLWSD::SSLEnabled? "https://": "http://") +
+            (LOOLWSD::ServerName.empty()? request.getHost(): LOOLWSD::ServerName) +
+            "/loleaflet/dist/loleaflet.html?";
 
         InputSource inputSrc(discoveryPath);
         AutoPtr<Poco::XML::Document> docXML = parser.parse(&inputSrc);
@@ -984,6 +986,7 @@ std::string LOOLWSD::SysTemplate;
 std::string LOOLWSD::LoTemplate;
 std::string LOOLWSD::ChildRoot;
 std::string LOOLWSD::LoSubPath = "lo";
+std::string LOOLWSD::ServerName;
 std::string LOOLWSD::FileServerRoot;
 std::string LOOLWSD::AdminCreds;
 bool LOOLWSD::AllowLocalStorage = false;
@@ -1051,6 +1054,11 @@ void LOOLWSD::initialize(Application& self)
         LoSubPath = getPathFromConfig("lo_jail_subpath");
     }
 
+    if (ServerName.empty())
+    {
+        ServerName = config().getString("server_name");
+    }
+
     if (FileServerRoot.empty())
     {
         FileServerRoot = getPathFromConfig("file_server_root_path");
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 4e1c127..ae290e4 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -43,6 +43,7 @@ public:
     static std::string LoTemplate;
     static std::string ChildRoot;
     static std::string LoSubPath;
+    static std::string ServerName;
     static std::string FileServerRoot;
     static std::string AdminCreds;
     static bool AllowLocalStorage;
diff --git a/loolwsd/loolwsd.xml b/loolwsd/loolwsd.xml
index 6b57c5a..daae5e7 100644
--- a/loolwsd/loolwsd.xml
+++ b/loolwsd/loolwsd.xml
@@ -5,9 +5,12 @@
     <lo_template_path desc="Path to a LibreOffice installation tree to be copied (linked) into the jails for child processes. Should be on the same file system as systemplate." type="path" relative="false" default="/opt/collaboraoffice5.0"></lo_template_path>
     <child_root_path desc="Path to the directory under which the chroot jails for the child processes will be created. Should be on the same file system as systemplate and lotemplate. Must be an empty directory." type="path" relative="true" default="jails"></child_root_path>
     <lo_jail_subpath desc="Relative path where the LibreOffice installation will be copied inside a jail." type="path" relative="true" default="lo">lo</lo_jail_subpath>
+
+    <server_name desc="Hostname:port of the server running loolwsd. If empty, it's derived from the request." type="string" default=""></server_name>
     <file_server_root_path desc="Path to the directory that should be considered root for the file server. This should be the directory containing loleaflet." type="path" relative="true" default="../loleaflet/../"></file_server_root_path>
 
     <num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="10">1</num_prespawn_children>
+
     <logging>
         <color type="bool">true</color>
         <level type="string">trace</level>


More information about the Libreoffice-commits mailing list