2018-09-12 18:31:25 +02:00
|
|
|
|
|
|
|
-- the rewrite rule for the framework
|
|
|
|
-- should be something like this
|
|
|
|
-- ^\/apps\/+(.*)$ = /apps/router.lua?r=<1>&<query>
|
|
|
|
-- some global variables
|
|
|
|
DIR_SEP = "/"
|
|
|
|
WWW_ROOT = "/opt/www/htdocs/os"
|
2018-10-08 19:33:12 +02:00
|
|
|
HTTP_ROOT = "http://os.localhost:9192"
|
2018-09-12 18:31:25 +02:00
|
|
|
-- class path: path.to.class
|
|
|
|
BASE_FRW = ""
|
|
|
|
-- class path: path.to.class
|
|
|
|
CONTROLLER_ROOT = BASE_FRW.."os.controllers"
|
|
|
|
MODEL_ROOT = BASE_FRW.."os.models"
|
|
|
|
-- file path: path/to/file
|
|
|
|
VIEW_ROOT = WWW_ROOT..DIR_SEP.."views"
|
|
|
|
LOG_ROOT = WWW_ROOT..DIR_SEP.."logs"
|
|
|
|
|
|
|
|
VFS_HOME = "/home/%s"
|
|
|
|
|
|
|
|
package.path = package.path..";"..WWW_ROOT .. '/libs/?.lua'
|
|
|
|
-- require needed library
|
|
|
|
require(BASE_FRW.."silk.api")
|
|
|
|
require("common")
|
|
|
|
|
|
|
|
|
|
|
|
-- registry object store global variables
|
|
|
|
local REGISTRY = {}
|
|
|
|
-- set logging level
|
|
|
|
REGISTRY.logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = true}}
|
2018-10-08 19:33:12 +02:00
|
|
|
--REGISTRY.db = DBHelper:new{db="sysdb"}
|
2018-09-12 18:31:25 +02:00
|
|
|
REGISTRY.layout = 'default'
|
|
|
|
REGISTRY.fileaccess = true
|
|
|
|
|
2018-10-08 19:33:12 +02:00
|
|
|
--REGISTRY.db:open()
|
2018-09-12 18:31:25 +02:00
|
|
|
local router = Router:new{registry = REGISTRY}
|
|
|
|
REGISTRY.router = router
|
|
|
|
router:setPath(CONTROLLER_ROOT)
|
|
|
|
|
|
|
|
router:delegate()
|
2018-10-08 19:33:12 +02:00
|
|
|
--if REGISTRY.db then REGISTRY.db:close() end
|
2018-09-12 18:31:25 +02:00
|
|
|
|