Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cgilua/src/launchers/cgilua.fcgi
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
34 lines (26 sloc)
1.15 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env lua | |
| -- CGILua (SAPI) launcher, extracts script to launch | |
| -- either from the command line (use #!cgilua in the script) | |
| -- or from SCRIPT_FILENAME/PATH_TRANSLATED | |
| pcall(require, "luarocks.require") | |
| local fastcgi = require "wsapi.fastcgi" | |
| local common = require "wsapi.common" | |
| local ok, err = pcall(require, "wsapi.fastcgi") | |
| if not ok then | |
| io.stderr:write("WSAPI FastCGI not loaded:\n" .. err .. "\n\nPlease install wsapi-fcgi with LuaRocks\n") | |
| os.exit(1) | |
| end | |
| local ONE_HOUR = 60 * 60 | |
| local ONE_DAY = 24 * ONE_HOUR | |
| local sapi_loader = common.make_isolated_launcher{ | |
| filename = nil, -- if you want to force the launch of a single script | |
| launcher = "cgilua.fcgi", -- the name of this launcher | |
| modname = "wsapi.sapi", -- WSAPI application that processes the script | |
| reload = false, -- if you want to reload the application on every request | |
| period = ONE_HOUR, -- frequency of Lua state staleness checks | |
| ttl = ONE_DAY, -- time-to-live for Lua states | |
| vars = -- order of checking for the path of the script | |
| { "SCRIPT_FILENAME", | |
| "PATH_TRANSLATED" } | |
| } | |
| fastcgi.run(sapi_loader) |