depctrl global config: only pass config to functions instead of whole file

This commit is contained in:
garret 2022-11-24 00:16:48 +00:00
parent 2d90b8e6df
commit c3454654c5
1 changed files with 2 additions and 3 deletions

View File

@ -62,8 +62,7 @@ local function get_human_filesize(bytes)
return bytes return bytes
end end
local function get_config(data) local function get_config(config)
local config = data.config
local defaults = {updaterEnabled = true, updateInterval = 302400, traceLevel = 3, extraFeeds = { }, tryAllFeeds = false, dumpFeeds = true, configDir = "?user/config", logMaxFiles = 200, logMaxAge = 604800, logMaxSize = 10 * (10 ^ 6), updateWaitTimeout = 60, updateOrphanTimeout = 600, logDir = "?user/log", writeLogs = true} local defaults = {updaterEnabled = true, updateInterval = 302400, traceLevel = 3, extraFeeds = { }, tryAllFeeds = false, dumpFeeds = true, configDir = "?user/config", logMaxFiles = 200, logMaxAge = 604800, logMaxSize = 10 * (10 ^ 6), updateWaitTimeout = 60, updateOrphanTimeout = 600, logDir = "?user/log", writeLogs = true}
local dialog = { local dialog = {
{ class="checkbox", name="updaterEnabled", { class="checkbox", name="updaterEnabled",
@ -178,7 +177,7 @@ end
local function change_config(new) -- i think i might be thinning out the soup a bit too much local function change_config(new) -- i think i might be thinning out the soup a bit too much
local config_path = get_config_path() local config_path = get_config_path()
local data = read_json(config_path) local data = read_json(config_path)
data.config = new(data) data.config = new(data.config)
write_json(config_path, data) write_json(config_path, data)
end end