Changeset

5296:78b7a4ad2f32

prosodyctl, prosody: Pass the selected config file from prosodyctl to prosody
author Kim Alvefur <zash@zash.se>
date Wed, 09 Jan 2013 22:01:52 +0100
parents 5295:eef393a37e38
children 5297:7453245f16e7
files prosody prosodyctl
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Wed Jan 09 20:40:44 2013 +0100
+++ b/prosody	Wed Jan 09 22:01:52 2013 +0100
@@ -70,6 +70,8 @@
 		if CFG_CONFIGDIR then
 			table.insert(filenames, CFG_CONFIGDIR.."/"..arg[2]);
 		end
+	elseif os.getenv("PROSODY_CONFIG") then -- Passed by prosodyctl
+			table.insert(filenames, os.getenv("PROSODY_CONFIG"));
 	else
 		for _, format in ipairs(config.parsers()) do
 			table.insert(filenames, (CFG_CONFIGDIR or ".").."/prosody.cfg."..format);
--- a/prosodyctl	Wed Jan 09 20:40:44 2013 +0100
+++ b/prosodyctl	Wed Jan 09 22:01:52 2013 +0100
@@ -61,6 +61,7 @@
 
 config = require "core.configmanager"
 
+local ENV_CONFIG;
 do
 	local filenames = {};
 	
@@ -81,6 +82,7 @@
 		local file = io.open(filename);
 		if file then
 			file:close();
+			ENV_CONFIG = filename;
 			CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$");
 			break;
 		end
@@ -162,6 +164,7 @@
 	-- Set our umask to protect data files
 	pposix.umask(config.get("*", "core", "umask") or "027");
 	pposix.setenv("HOME", data_path);
+	pposix.setenv("PROSODY_CONFIG", ENV_CONFIG);
 else
 	print("Error: Unable to load pposix module. Check that Prosody is installed correctly.")
 	print("For more help send the below error to us through http://prosody.im/discuss");