mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-14 12:38:47 +00:00
Change. Use require "resources.functions.config" to load config file.
Change. Move `script_dir` definition into config file.
This commit is contained in:
@@ -1,12 +1,26 @@
|
||||
|
||||
-- add file_exists function
|
||||
require "resources.functions.file_exists";
|
||||
|
||||
--find and return path to the config.lua
|
||||
function config()
|
||||
dofile(scripts_dir.."/resources/functions/file_exists.lua");
|
||||
if (file_exists("/etc/fusionpbx/config.lua")) then
|
||||
return "/etc/fusionpbx/config.lua";
|
||||
elseif (file_exists("/usr/local/etc/fusionpbx/config.lua")) then
|
||||
return "/usr/local/etc/fusionpbx/config.lua";
|
||||
else
|
||||
return scripts_dir.."/resources/config.lua";
|
||||
return "resources.config";
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- load config
|
||||
function load_config()
|
||||
local cfg = config()
|
||||
if cfg:sub(1,1) == '//' then
|
||||
dofile(cfg)
|
||||
else
|
||||
require(cfg)
|
||||
end
|
||||
end
|
||||
|
||||
load_config()
|
||||
|
||||
Reference in New Issue
Block a user