summaryrefslogtreecommitdiffstats
path: root/squid-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'squid-model.lua')
-rw-r--r--squid-model.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/squid-model.lua b/squid-model.lua
index c61a4e7..f1fee43 100644
--- a/squid-model.lua
+++ b/squid-model.lua
@@ -38,3 +38,36 @@ service_control = function( control )
return retval
end
+get_config = function()
+
+ local retval = ""
+
+ local ptr = io.open( "/etc/squid/squid.conf", "r" )
+ if ptr ~= nil then
+ local retcfg = ptr:read( "*a" )
+ ptr:close()
+ if retcfg == nil then
+ retval = "\n\n Error: Failed to read /etc/squid/squid.conf!\n\n"
+ else
+ retval = retcfg
+ end
+ end
+
+ return retval
+end
+
+update_config = function( config )
+
+ local retval = "Successfully updated /etc/squid/squid.conf!"
+
+ local ptr = io.open( "/etc/squid/squid.conf", "wb+" )
+ if ptr ~= nil then
+ ptr:write( config )
+ ptr:close()
+ else
+ retval = "update_config(): Error, failed to open /etc/squid/squid.conf!\n"
+ end
+
+ return retval
+end
+