From 0be9cc50c885abe6a85bc398d999ab6cda2eb44a Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 25 Dec 2009 08:52:50 +0000 Subject: Change processname to match prefix - this allows multiple instances without editing. --- tinydns-controller.lua | 5 +++++ tinydns-model.lua | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/tinydns-controller.lua b/tinydns-controller.lua index 0461ed9..64a224c 100644 --- a/tinydns-controller.lua +++ b/tinydns-controller.lua @@ -2,6 +2,11 @@ module(..., package.seeall) require("controllerfunctions") require("validator") +mvc = {} +mvc.on_load = function(self, parent) + self.model.set_processname(string.match(self.conf.prefix, "[^/]+")) +end + default_action = "status" function status(self) diff --git a/tinydns-model.lua b/tinydns-model.lua index 5a59c89..a4fd0e5 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -49,6 +49,12 @@ local descr = { }, } +function set_processname(p) + processname = p + configfile = "/etc/conf.d/" .. processname + configdir = "/etc/"..processname +end + -- ################################################################################ -- LOCAL FUNCTIONS -- cgit v1.2.3