aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-12-08 00:55:17 +0000
committerMatthew Wild <mwild1@gmail.com>2009-12-08 00:55:17 +0000
commitd6ffcdeffa791416ca51309d016d17f5aa05c2e5 (patch)
tree6536991dd54101b31e0e20b3ae7a5d6c70c2eed9 /prosody
parent0ec240d5e317f2bd29c52fceaf025b3d73df1ec0 (diff)
downloadprosody-d6ffcdeffa791416ca51309d016d17f5aa05c2e5.tar.gz
prosody-d6ffcdeffa791416ca51309d016d17f5aa05c2e5.zip
prosody: Clarify and add some comments to describe what we're doing when and why
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody15
1 files changed, 12 insertions, 3 deletions
diff --git a/prosody b/prosody
index 6df7428b..968a5f54 100755
--- a/prosody
+++ b/prosody
@@ -16,6 +16,7 @@ CFG_DATADIR=os.getenv("PROSODY_DATADIR");
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+-- Tell Lua where to find our libraries
if CFG_SOURCEDIR then
package.path = CFG_SOURCEDIR.."/?.lua;"..package.path;
package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
@@ -24,6 +25,7 @@ end
package.path = package.path..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.lua";
package.cpath = package.cpath..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.so";
+-- Substitute ~ with path to home directory in data path
if CFG_DATADIR then
if os.getenv("HOME") then
CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME"));
@@ -31,9 +33,10 @@ if CFG_DATADIR then
end
-- Required to be able to find packages installed with luarocks
-pcall(require, "luarocks.require")
+pcall(require, "luarocks.require");
--- Replace require with one that doesn't pollute _G
+-- Replace require() with one that doesn't pollute _G, required
+-- for neat sandboxing of modules
do
local _realG = _G;
local _real_require = require;
@@ -52,9 +55,14 @@ do
end
end
-
+-- Load the config-parsing module
config = require "core.configmanager"
+-- -- -- --
+-- Define the functions we call during startup, the
+-- actual startup happens right at the end, where these
+-- functions get called
+
function read_config()
-- TODO: Check for other formats when we add support for them
-- Use lfs? Make a new conf/ dir?
@@ -363,6 +371,7 @@ function cleanup()
server.setquitting(true);
end
+-- Are you ready? :)
read_config();
load_libraries();
init_global_state();