prosodyctl, prosody: Pass the selected config file from prosodyctl to prosody
authorKim Alvefur <zash@zash.se>
Wed, 9 Jan 2013 21:01:52 +0000 (22:01 +0100)
committerKim Alvefur <zash@zash.se>
Wed, 9 Jan 2013 21:01:52 +0000 (22:01 +0100)
prosody
prosodyctl

diff --git a/prosody b/prosody
index da77719daf317b8a99ca08f1a89af71b40299a5e..00fde04cd4243410d5032835493085e460dac0d0 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -70,6 +70,8 @@ function read_config()
                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);
index 25acbc6ab90f8e6159d449b852f2d04690ec705c..0d1194f44131d92e4f8a81d145fd2c6ac20c9207 100755 (executable)
@@ -61,6 +61,7 @@ end
 
 config = require "core.configmanager"
 
+local ENV_CONFIG;
 do
        local filenames = {};
        
@@ -81,6 +82,7 @@ do
                local file = io.open(filename);
                if file then
                        file:close();
+                       ENV_CONFIG = filename;
                        CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$");
                        break;
                end
@@ -162,6 +164,7 @@ if ok and pposix then
        -- 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");