migrator: Customise startup sequence to fix #1673 (Thanks acidsys)
authorKim Alvefur <zash@zash.se>
Thu, 29 Jul 2021 13:47:26 +0200
changeset 11732 826d57c16d1c
parent 11731 f3aee8a825cc
child 11733 f37cafeb75d6
migrator: Customise startup sequence to fix #1673 (Thanks acidsys) Diverge from util.startup.prosodyctl() in order to skip unneeded behavior, such as loading the *Prosody* config file, which we do not need here, based on the `--config` flag which should point at the migrator config file instead. Notably removed: * read_config() since this loads the Prosody config * check_unwriteable() which checks logfiles specified in the Prosody config, so not relevant * make_dummy_hosts() but the migrator sets up its own hosts during migration
tools/migration/prosody-migrator.lua
--- a/tools/migration/prosody-migrator.lua	Tue Jul 27 00:13:18 2021 +0200
+++ b/tools/migration/prosody-migrator.lua	Thu Jul 29 13:47:26 2021 +0200
@@ -35,8 +35,25 @@
 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua";
 
 local startup = require "util.startup";
-startup.prosodyctl();
--- TODO startup.migrator ?
+do
+	startup.parse_args();
+	startup.init_global_state();
+	prosody.process_type = "migrator";
+	startup.force_console_logging();
+	startup.init_logging();
+	startup.init_gc();
+	startup.init_errors();
+	startup.setup_plugindir();
+	startup.setup_plugin_install_path();
+	startup.setup_datadir();
+	startup.chdir();
+	startup.read_version();
+	startup.switch_user();
+	startup.check_dependencies();
+	startup.log_startup_warnings();
+	startup.load_libraries();
+	startup.init_http_client();
+end
 
 -- Command-line parsing
 local options = {};