diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-12-30 14:33:49 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-12-30 14:33:49 +0000 |
commit | 6c9f16f82e911e1b2c05918f9b8ce0d78fb3aa55 (patch) | |
tree | 30dc8373ce37fab5ac71d2a7b2902da0c3535e65 | |
parent | 38c8fad89c24a031b4c88e94066797a00b7774ab (diff) | |
download | acf-core-6c9f16f82e911e1b2c05918f9b8ce0d78fb3aa55.tar.bz2 acf-core-6c9f16f82e911e1b2c05918f9b8ce0d78fb3aa55.tar.xz |
Cleaned up acf.conf, removed hardcoded /usr/share/acf paths.
-rw-r--r-- | acf.conf | 5 | ||||
-rw-r--r-- | app/acf_cli-controller.lua | 7 | ||||
-rw-r--r-- | app/acf_www-controller.lua | 5 | ||||
-rw-r--r-- | lib/roles.lua | 4 | ||||
-rwxr-xr-x | www/cgi-bin/cli | 5 | ||||
-rw-r--r-- | www/cgi-bin/mvc.lua | 9 |
6 files changed, 17 insertions, 18 deletions
@@ -3,6 +3,7 @@ # Directories where the application resides appdir=/usr/share/acf/app/ libdir=/usr/share/acf/lib/ +wwwdir=/usr/share/acf/www/ # sessiondir is where the session state files are stored sessiondir=/tmp/ @@ -11,10 +12,6 @@ sessiondir=/tmp/ skindir=/skins/ skin=alps -# The login system credentials file -passfile=/etc/acf/passwd - - # Auditing can be done before and/or after a commit (controller permitting) # ${TEMPFILE} and ${CONFFILE} are used precommit # only ${CONFFILE} has any meaning postcommit diff --git a/app/acf_cli-controller.lua b/app/acf_cli-controller.lua index d2b57e2..c2abaee 100644 --- a/app/acf_cli-controller.lua +++ b/app/acf_cli-controller.lua @@ -1,13 +1,14 @@ module(..., package.seeall) +require("posix") + -- We use the parent exception handler in a last-case situation local parent_exception_handler mvc = {} mvc.on_load = function (self, parent) - -- Make sure we have some kind of sane defaults for libdir and sessiondir - self.conf.libdir = self.conf.libdir or ( self.conf.appdir .. "/lib/" ) - self.conf.sessiondir = self.conf.sessiondir or "/tmp/" + -- Make sure we have some kind of sane defaults for libdir + self.conf.libdir = self.conf.libdir or ( posix.dirname(self.conf.appdir) .. "/lib/" ) self.conf.script = "" self.conf.default_prefix = "/acf-util/" self.conf.default_controller = "welcome" diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 5803464..9c63d74 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -223,8 +223,9 @@ mvc.on_load = function (self, parent) --logevent("acf_www-controller mvc.on_load") - -- Make sure we have some kind of sane defaults for libdir and sessiondir - self.conf.libdir = self.conf.libdir or ( self.conf.appdir .. "/lib/" ) + -- Make sure we have some kind of sane defaults for libdir, wwwdir, and sessiondir + self.conf.libdir = self.conf.libdir or ( posix.dirname(self.conf.appdir) .. "/lib/" ) + self.conf.wwwdir = self.conf.wwwdir or ( posix.dirname(self.conf.appdir) .. "/www/" ) self.conf.sessiondir = self.conf.sessiondir or "/tmp/" self.conf.script = ENV.SCRIPT_NAME self.conf.default_prefix = "/acf-util/" diff --git a/lib/roles.lua b/lib/roles.lua index 0366a30..bfd45cf 100644 --- a/lib/roles.lua +++ b/lib/roles.lua @@ -17,7 +17,7 @@ end -- Return a list of *controller.lua files list_controllers = function(self) local list = {} - for file in fs.find(".*controller%.lua", "/usr/share/acf", true) do + for file in fs.find(".*controller%.lua", self.conf.appdir, true) do if not string.find(file, "acf_") then list[#list + 1] = file end @@ -29,7 +29,7 @@ end -- Return information about all or specified controller files get_controllers = function(self,pre,controller) --we get all the controllers - local list = roles.list_controllers() + local list = roles.list_controllers(self) --we need to grab the directory and name of file local temp = {} for k,v in pairs(list) do diff --git a/www/cgi-bin/cli b/www/cgi-bin/cli index 9e8ce02..1221481 100755 --- a/www/cgi-bin/cli +++ b/www/cgi-bin/cli @@ -18,8 +18,11 @@ Output will be a serialized Lua table. return end +require("posix") local PATH = package.path -package.path = "/usr/share/acf/www/cgi-bin/?.lua;" .. package.path +local p = posix.dirname(arg[0]) +if p:sub(1,1) ~= "/" then p = posix.getcwd().."/"..p end +package.path = p.."/?.lua;" .. package.path require("mvc") package.path = PATH diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index c7afdcd..db29bda 100644 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -242,13 +242,10 @@ read_config = function( self, appname ) local file = io.open (filename) if (file) then self.conf.confdir = posix.dirname(filename) .. "/" + self.conf.conffile = filename for line in file:lines() do - key, value = string.match(line, "([^[=]*)=[ \t]*(.*)") - if key then -- ugly way of finding blank spots between key and = - repeat - local space = string.find ( key, "%s", -1) - if space then key=string.sub(key,1,space-1) end - until space == nil + key, value = string.match(line, "^%s*([^[=%s#]*)%s*=%s*(.*)") + if key then self.conf[key] = value end end |