/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. -- Orbit pages launcher, extracts script to launch
  3. local common = require "wsapi.common"
  4. local ok, err = pcall(require, "wsapi.fastcgi")
  5. if not ok then
  6. io.stderr:write("WSAPI FastCGI not loaded:\n" .. err .. "\n\nPlease install wsapi-fcgi with LuaRocks\n")
  7. os.exit(1)
  8. end
  9. local ok, err = pcall(require, "cosmo")
  10. if not ok then
  11. io.stderr:write("Cosmo not loaded:\n" .. err .. "\n\nPlease install cosmo with LuaRocks\n")
  12. os.exit(1)
  13. end
  14. local ONE_HOUR = 60 * 60
  15. local ONE_DAY = 24 * ONE_HOUR
  16. local op_loader = common.make_isolated_launcher{
  17. filename = nil, -- if you want to force the launch of a single script
  18. launcher = "op.fcgi", -- the name of this launcher
  19. modname = "orbit.pages", -- WSAPI application that processes the script
  20. reload = false, -- if you want to reload the application on every request
  21. period = ONE_HOUR, -- frequency of Lua state staleness checks
  22. ttl = ONE_DAY, -- time-to-live for Lua states
  23. vars = -- order of checking for the path of the script
  24. { "SCRIPT_FILENAME",
  25. "PATH_TRANSLATED" }
  26. }
  27. wsapi.fastcgi.run(op_loader)