X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=prosodyctl;h=0d1194f44131d92e4f8a81d145fd2c6ac20c9207;hb=156ad360575c2c2b61a0d1fcdb0c0884cf3a5eda;hp=e26339e28ef1db0a1827230373ead4c939bf3fd0;hpb=6925cdc57b9ad537a619f98c10234f3af4497408;p=prosody.git diff --git a/prosodyctl b/prosodyctl index e26339e2..0d1194f4 100755 --- a/prosodyctl +++ b/prosodyctl @@ -61,16 +61,17 @@ end config = require "core.configmanager" +local ENV_CONFIG; do local filenames = {}; local filename; if arg[1] == "--config" and arg[2] then table.insert(filenames, arg[2]); - table.remove(arg, 1); table.remove(arg, 1); if CFG_CONFIGDIR then table.insert(filenames, CFG_CONFIGDIR.."/"..arg[2]); end + table.remove(arg, 1); table.remove(arg, 1); else for _, format in ipairs(config.parsers()) do table.insert(filenames, (CFG_CONFIGDIR or ".").."/prosody.cfg."..format); @@ -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"); @@ -227,6 +230,7 @@ local function make_host(hostname) return { type = "local", events = prosody.events, + modules = {}, users = require "core.usermanager".new_null_provider(hostname) }; end @@ -638,8 +642,8 @@ function commands.unregister(arg) return 1; end -local openssl = require "util.openssl"; -local lfs = require "lfs"; +local openssl; +local lfs; local cert_commands = {}; @@ -722,7 +726,7 @@ end function cert_commands.generate(arg) if #arg >= 1 and arg[1] ~= "--help" then - local cert_filename = (CFG_DATADIR or ".") .. "/" .. arg[1] .. ".cert"; + local cert_filename = (CFG_DATADIR or ".") .. "/" .. arg[1] .. ".crt"; if ask_overwrite(cert_filename) then return nil, cert_filename; end @@ -743,6 +747,8 @@ end function commands.cert(arg) if #arg >= 1 and arg[1] ~= "--help" then + openssl = require "util.openssl"; + lfs = require "lfs"; local subcmd = table.remove(arg, 1); if type(cert_commands[subcmd]) == "function" then if not arg[1] then