summaryrefslogtreecommitdiffstats
path: root/tinydns-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r--tinydns-model.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua
index 3b91cb3..7ac2495 100644
--- a/tinydns-model.lua
+++ b/tinydns-model.lua
@@ -7,6 +7,7 @@ require("fs")
require("format")
require("processinfo")
require("daemoncontrol")
+require("validator")
-- Set variables
local configdir
@@ -362,12 +363,19 @@ function getconfig(self,filter_type)
local config = {}
local listenaddr = getopts.getoptsfromfile_onperline(configfile,"IP") or {}
+
config.listen = cfe({
name = "listen",
label="IP address to listen on",
value=listenaddr.IP or "",
})
+ config.baseurl = cfe({
+ name = "baseurl",
+ label="Baseurl for configfiles",
+ value=baseurl,
+ })
+
return config
end
@@ -712,3 +720,17 @@ function updatefilecontent (self, filetochange)
end
return false, "Something went wrong!"
end
+
+function createconfigfile (self, path)
+ local validfilepath, filepatherror = validator.is_valid_filename(path,baseurl)
+ if (fs.is_file(path)) then
+ return false,"File already exists"
+ end
+ if (validfilepath) then
+ fs.write_file(path, "")
+ return true,nil
+ else
+ return false, filepatherror
+ end
+ return false, "Something went wrong!"
+end