Software /
code /
prosody
Comparison
prosodyctl @ 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 |
parent | 5295:eef393a37e38 |
child | 5303:19a4a3462574 |
child | 5384:24f4aed5824f |
comparison
equal
deleted
inserted
replaced
5295:eef393a37e38 | 5296:78b7a4ad2f32 |
---|---|
59 os.exit(1); | 59 os.exit(1); |
60 end | 60 end |
61 | 61 |
62 config = require "core.configmanager" | 62 config = require "core.configmanager" |
63 | 63 |
64 local ENV_CONFIG; | |
64 do | 65 do |
65 local filenames = {}; | 66 local filenames = {}; |
66 | 67 |
67 local filename; | 68 local filename; |
68 if arg[1] == "--config" and arg[2] then | 69 if arg[1] == "--config" and arg[2] then |
79 for _,_filename in ipairs(filenames) do | 80 for _,_filename in ipairs(filenames) do |
80 filename = _filename; | 81 filename = _filename; |
81 local file = io.open(filename); | 82 local file = io.open(filename); |
82 if file then | 83 if file then |
83 file:close(); | 84 file:close(); |
85 ENV_CONFIG = filename; | |
84 CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$"); | 86 CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$"); |
85 break; | 87 break; |
86 end | 88 end |
87 end | 89 end |
88 local ok, level, err = config.load(filename); | 90 local ok, level, err = config.load(filename); |
160 end | 162 end |
161 | 163 |
162 -- Set our umask to protect data files | 164 -- Set our umask to protect data files |
163 pposix.umask(config.get("*", "core", "umask") or "027"); | 165 pposix.umask(config.get("*", "core", "umask") or "027"); |
164 pposix.setenv("HOME", data_path); | 166 pposix.setenv("HOME", data_path); |
167 pposix.setenv("PROSODY_CONFIG", ENV_CONFIG); | |
165 else | 168 else |
166 print("Error: Unable to load pposix module. Check that Prosody is installed correctly.") | 169 print("Error: Unable to load pposix module. Check that Prosody is installed correctly.") |
167 print("For more help send the below error to us through http://prosody.im/discuss"); | 170 print("For more help send the below error to us through http://prosody.im/discuss"); |
168 print(tostring(pposix)) | 171 print(tostring(pposix)) |
169 os.exit(1); | 172 os.exit(1); |