summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dnscache-model.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/dnscache-model.lua b/dnscache-model.lua
index 88b6335..d3db087 100644
--- a/dnscache-model.lua
+++ b/dnscache-model.lua
@@ -3,7 +3,6 @@ module(..., package.seeall)
-- Load libraries
require("modelfunctions")
require("fs")
-require("getopts")
require("format")
require("posix")
require("validator")
@@ -69,7 +68,7 @@ function getstatus()
end
function getconfig()
- local conf = getopts.getoptsfromfile(configfile, "") or {}
+ local conf = format.parse_configfile2(fs.read_file(configfile), "") or {}
local output = {}
output.IPSEND = cfe({ value = conf.IPSEND or "", label="IP address for requests",
descr="Use 0.0.0.0 for default address" })
@@ -85,13 +84,13 @@ function setconfig(config)
if success then
local file = fs.read_file(configfile)
- getopts.setoptsinfile(file,"","IPSEND",config.value.IPSEND.value)
- getopts.setoptsinfile(file,"","CACHESIZE",config.value.CACHESIZE.value)
- getopts.setoptsinfile(file,"","IP",config.value.IP.value)
- if config.value.IPSEND.value then
- getopts.setoptsinfile(file,"","FORWARDONLY",config.value.IPSEND.value)
+ file = format.update_configfile2(file,"","IPSEND",config.value.IPSEND.value)
+ file = format.update_configfile2(file,"","CACHESIZE",config.value.CACHESIZE.value)
+ file = format.update_configfile2(file,"","IP",config.value.IP.value)
+ if config.value.FORWARDONLY.value then
+ file = format.update_configfile2(file,"","FORWARDONLY","true")
else
- getopts.setoptsinfile(file,"","FORWARDONLY","")
+ file = format.update_configfile2(file,"","FORWARDONLY","")
end
fs.write_file(configfile, file)
else