29 lines
958 B
Lua
29 lines
958 B
Lua
-- Load this file in `nginx.conf`:
|
||
--
|
||
-- ```
|
||
-- http {
|
||
-- init_by_lua_file /path/to/do_init.lua;
|
||
-- …
|
||
-- }
|
||
-- ```
|
||
|
||
-- strip initial `@` and final `/do_init.lua` from this file’s path, and add it to `package.path`
|
||
local here = debug.getinfo(1).source:sub(2, -13)
|
||
package.path = here .. "/?.lua;" .. package.path
|
||
|
||
-- modules using singleton-style configuration → load and init them
|
||
local config = require("ssso_config") -- init required from storage
|
||
local _ = require("ssso_crypto") -- init required for a shared secret
|
||
local login = require("ssso_login") -- init required from storage
|
||
local portal = require("ssso_portal") -- init required from storage
|
||
local sites = require("ssso_sites") -- init required from storage
|
||
|
||
config.load_conf(here)
|
||
login.set_root(here)
|
||
portal.set_root(here)
|
||
sites.load_sites(here)
|
||
|
||
-- modules used for _each_ page access → load them in memory
|
||
local _ = require("ssso_nginx")
|
||
local _ = require("ssso_sessions")
|