-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverrides-handler.lua
34 lines (31 loc) · 1.04 KB
/
overrides-handler.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Do not modify this file, it's maintained by the repo.
-- Add your overrides into the conf.d directory instead
-- (you may copy and options.lua there and modify what you want)
local conf_d_path = g.pdns_scripts_path .. '/conf.d'
local options_overrides = {}
package.path = package.path .. ";"..conf_d_path.."/?.lua"
local function get_lua_modules_in_conf(search_dir, fullpath)
local files = {}
for dir in io.popen("ls -pa " .. search_dir .. " | grep -v /|grep -E \"*(.lua)\""):lines()
do
if dir == 'example.lua' then goto continue end
if fullpath then
table.insert(files, conf_d_path .. "/" .. dir)
else
table.insert(files, tostring(string.gsub(dir, '%.lua', '')))
end
::continue::
end
return files
end
local conf_files = get_lua_modules_in_conf(conf_d_path, false)
for index, lua_file in ipairs(conf_files) do
if pdns then
pdnslog("Including config file: "..lua_file, pdns.loglevels.Notice)
end
local params = require(lua_file)
for key, value in pairs(params) do
options_overrides[key] = params[key]
end
end
return options_overrides