aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/startup.lua29
1 files changed, 20 insertions, 9 deletions
diff --git a/util/startup.lua b/util/startup.lua
index ba83eca5..a33f3f3b 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -192,16 +192,8 @@ function startup.init_global_state()
full_sessions = prosody.full_sessions;
hosts = prosody.hosts;
- local data_path = config.get("*", "data_path") or CFG_DATADIR or "data";
- local custom_plugin_paths = config.get("*", "plugin_paths");
- if custom_plugin_paths then
- local path_sep = package.config:sub(3,3);
- -- path1;path2;path3;defaultpath...
- -- luacheck: ignore 111
- CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
- end
prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR or ".",
- plugins = CFG_PLUGINDIR or "plugins", data = data_path };
+ plugins = CFG_PLUGINDIR or "plugins", data = "data" };
prosody.arg = _G.arg;
@@ -210,6 +202,21 @@ function startup.init_global_state()
_G.prosody = prosody;
end
+function startup.setup_datadir()
+ prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data";
+end
+
+function startup.setup_plugindir()
+ local custom_plugin_paths = config.get("*", "plugin_paths");
+ if custom_plugin_paths then
+ local path_sep = package.config:sub(3,3);
+ -- path1;path2;path3;defaultpath...
+ -- luacheck: ignore 111
+ CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
+ end
+ prosody.paths.plugins = CFG_PLUGINDIR;
+end
+
function startup.chdir()
if prosody.installed then
-- Change working directory to data path.
@@ -491,6 +498,8 @@ end
function startup.prosodyctl()
startup.read_config();
startup.init_global_state();
+ startup.setup_plugindir();
+ startup.setup_datadir();
startup.chdir();
startup.read_version();
startup.switch_user();
@@ -515,6 +524,8 @@ function startup.prosody()
startup.check_dependencies();
startup.load_libraries();
startup.init_global_state();
+ startup.setup_plugindir();
+ startup.setup_datadir();
startup.init_logging();
startup.chdir();
startup.add_global_prosody_functions();