PageRenderTime 14ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/launchers/op.fcgi

http://github.com/keplerproject/orbit
Lua | 36 lines | 26 code | 9 blank | 1 comment | 2 complexity | bdd2665ea15687474b2929f122b98154 MD5 | raw file
 1#!/usr/bin/lua
 2
 3-- Orbit pages launcher, extracts script to launch
 4
 5local common = require "wsapi.common"
 6
 7local ok, err = pcall(require, "wsapi.fastcgi")
 8
 9if not ok then
10  io.stderr:write("WSAPI FastCGI not loaded:\n" .. err .. "\n\nPlease install wsapi-fcgi with LuaRocks\n")
11  os.exit(1)
12end
13
14local ok, err = pcall(require, "cosmo")
15
16if not ok then
17  io.stderr:write("Cosmo not loaded:\n" .. err .. "\n\nPlease install cosmo with LuaRocks\n")
18  os.exit(1)
19end
20
21local ONE_HOUR = 60 * 60
22local ONE_DAY = 24 * ONE_HOUR
23
24local op_loader = common.make_isolated_launcher{
25  filename = nil,          -- if you want to force the launch of a single script
26  launcher = "op.fcgi",    -- the name of this launcher
27  modname = "orbit.pages", -- WSAPI application that processes the script
28  reload = false,          -- if you want to reload the application on every request
29  period = ONE_HOUR,       -- frequency of Lua state staleness checks
30  ttl = ONE_DAY,           -- time-to-live for Lua states
31  vars =                   -- order of checking for the path of the script
32   { "SCRIPT_FILENAME",
33     "PATH_TRANSLATED" } 
34}
35
36wsapi.fastcgi.run(op_loader)