[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/loolwsd.xml.in
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Jun 26 00:29:46 UTC 2016
loolwsd/LOOLWSD.cpp | 97 ++++---------------------------------------------
loolwsd/LOOLWSD.hpp | 3 +
loolwsd/loolwsd.xml.in | 2 -
3 files changed, 11 insertions(+), 91 deletions(-)
New commits:
commit 6501a21114a9d9f258d96d500ae48af5df29d7ec
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Jun 25 18:03:41 2016 -0400
bccu#1909 - loolwsd command line options vs. config file and package upgrades
Remove command-line arguments in favor of the config file.
Settings can be overridden using the command-line flag
--override (or --o) followed by the full XML path=value.
Change-Id: I902a145f4d2bd0256e31a3e70b0382c0261aecc8
Reviewed-on: https://gerrit.libreoffice.org/26669
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 8ce6303..c48e514 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1282,46 +1282,14 @@ void LOOLWSD::initialize(Application& self)
// Allow UT to manipulate before using configuration values.
UnitWSD::get().configure(config());
- if (Cache.empty())
- {
- Cache = getPathFromConfig("tile_cache_path");
- }
-
- if (SysTemplate.empty())
- {
- SysTemplate = getPathFromConfig("sys_template_path");
- }
-
- if (LoTemplate.empty())
- {
- LoTemplate = getPathFromConfig("lo_template_path");
- }
-
- if (ChildRoot.empty())
- {
- ChildRoot = getPathFromConfig("child_root_path");
- }
-
- if (LoSubPath.empty())
- {
- LoSubPath = getPathFromConfig("lo_jail_subpath");
- }
-
- if (ServerName.empty())
- {
- ServerName = config().getString("server_name");
- }
-
- if (FileServerRoot.empty())
- {
- FileServerRoot = getPathFromConfig("file_server_root_path");
- }
-
- if (NumPreSpawnedChildren == 0)
- {
- // Default to 1 child.
- NumPreSpawnedChildren = getUIntConfigValue(conf, "num_prespawn_children", 1);
- }
+ Cache = getPathFromConfig("tile_cache_path");
+ SysTemplate = getPathFromConfig("sys_template_path");
+ LoTemplate = getPathFromConfig("lo_template_path");
+ ChildRoot = getPathFromConfig("child_root_path");
+ LoSubPath = getPathFromConfig("lo_jail_subpath");
+ ServerName = config().getString("server_name");
+ FileServerRoot = getPathFromConfig("file_server_root_path");
+ NumPreSpawnedChildren = getUIntConfigValue(conf, "num_prespawn_children", 1);
const auto maxConcurrency = getUIntConfigValue(conf, "per_document.max_concurrency", 4);
if (maxConcurrency > 0)
@@ -1398,41 +1366,6 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
.repeatable(false)
.argument("port number"));
- optionSet.addOption(Option("cache", "", "Path to a directory where to keep the tile cache (default: " + std::string(LOOLWSD_CACHEDIR) + ").")
- .required(false)
- .repeatable(false)
- .argument("directory"));
-
- optionSet.addOption(Option("systemplate", "", "Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes.")
- .required(false)
- .repeatable(false)
- .argument("directory"));
-
- optionSet.addOption(Option("lotemplate", "", "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.")
- .required(false)
- .repeatable(false)
- .argument("directory"));
-
- optionSet.addOption(Option("childroot", "", "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.")
- .required(false)
- .repeatable(false)
- .argument("directory"));
-
- optionSet.addOption(Option("losubpath", "", "Relative path where the LibreOffice installation will be copied inside a jail (default: '" + LoSubPath + "').")
- .required(false)
- .repeatable(false)
- .argument("relative path"));
-
- optionSet.addOption(Option("fileserverroot", "", "Path to the directory that should be considered root for the file server (default: '../loleaflet/').")
- .required(false)
- .repeatable(false)
- .argument("directory"));
-
- optionSet.addOption(Option("numprespawns", "", "Number of child processes to keep started in advance and waiting for new clients.")
- .required(false)
- .repeatable(false)
- .argument("number"));
-
optionSet.addOption(Option("admincreds", "", "Admin 'username/password' used to access the admin console.")
.required(false)
.repeatable(false)
@@ -1478,20 +1411,6 @@ void LOOLWSD::handleOption(const std::string& optionName,
DisplayVersion = true;
else if (optionName == "port")
ClientPortNumber = std::stoi(value);
- else if (optionName == "cache")
- Cache = value;
- else if (optionName == "systemplate")
- SysTemplate = value;
- else if (optionName == "lotemplate")
- LoTemplate = value;
- else if (optionName == "childroot")
- ChildRoot = value;
- else if (optionName == "losubpath")
- LoSubPath = value;
- else if (optionName == "fileserverroot")
- FileServerRoot = value;
- else if (optionName == "numprespawns")
- NumPreSpawnedChildren = std::stoi(value);
else if (optionName == "admincreds")
AdminCreds = value;
else if (optionName == "allowlocalstorage")
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 248b240..42780dd 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -107,7 +107,8 @@ private:
}
// Reconstruct absolute path if relative.
- if (config().hasProperty(property + "[@relative]") &&
+ if (!Poco::Path(path).isAbsolute() &&
+ config().hasProperty(property + "[@relative]") &&
config().getBool(property + "[@relative]"))
{
path = Poco::Path(Application::instance().commandPath()).parent().append(path).toString();
diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in
index 0bd3383..8baa2c8 100644
--- a/loolwsd/loolwsd.xml.in
+++ b/loolwsd/loolwsd.xml.in
@@ -7,7 +7,7 @@
<sys_template_path desc="Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes." type="path" relative="true" default="systemplate"></sys_template_path>
<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>
+ <lo_jail_subpath desc="Relative path where the LibreOffice installation will be copied inside a jail. Set relative to false to prevent expanding the path." type="path" relative="false" 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>
More information about the Libreoffice-commits
mailing list