mod_posix: Support for command-line flags to override 'daemonize' config option 0.11
authorMatthew Wild <mwild1@gmail.com>
Sun, 19 Jan 2020 15:28:09 +0000
branch0.11
changeset 10602 5cf481bee678
parent 10601 25a3c8134b0a
child 10603 4f655918fef1
child 10604 08f2fe5ac30f
mod_posix: Support for command-line flags to override 'daemonize' config option -D / --daemonize -F / --no-daemonize
plugins/mod_posix.lua
--- a/plugins/mod_posix.lua	Sun Jan 19 15:27:16 2020 +0000
+++ b/plugins/mod_posix.lua	Sun Jan 19 15:28:09 2020 +0000
@@ -126,7 +126,12 @@
 end
 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker);
 
-local daemonize = module:get_option("daemonize", prosody.installed);
+local daemonize = prosody.opts.daemonize;
+
+if daemonize == nil then
+	-- Fall back to config file if not specified on command-line
+	daemonize = module:get_option("daemonize", prosody.installed);
+end
 
 local function remove_log_sinks()
 	local lm = require "core.loggingmanager";