2013-10-20 16:38:49 +02:00
|
|
|
-- Remove prepending '@' & trailing 'init.lua'
|
|
|
|
script_path = string.sub(debug.getinfo(1).source, 2, -9)
|
|
|
|
|
|
|
|
-- Include local libs in package.path
|
|
|
|
package.path = package.path .. ";"..script_path.."?.lua"
|
|
|
|
|
2013-10-15 10:11:39 +02:00
|
|
|
-- Load libraries
|
2013-10-15 13:58:16 +02:00
|
|
|
json = require "json"
|
2013-10-15 10:11:39 +02:00
|
|
|
lualdap = require "lualdap"
|
|
|
|
math = require "math"
|
2013-10-20 16:38:49 +02:00
|
|
|
hige = require "hige"
|
2013-10-15 10:11:39 +02:00
|
|
|
|
|
|
|
-- Set random key
|
|
|
|
math.randomseed(os.time())
|
2013-10-30 17:29:19 +01:00
|
|
|
ngx.shared.cache:add("srvkey", math.random(1111111, 9999999))
|
2013-10-15 10:11:39 +02:00
|
|
|
|
2013-10-15 13:58:16 +02:00
|
|
|
-- Shared table
|
2013-10-20 22:07:26 +02:00
|
|
|
flashs = {}
|
2013-10-16 23:53:14 +02:00
|
|
|
login = {}
|
|
|
|
logout = {}
|
2013-10-16 11:27:18 +02:00
|
|
|
|
|
|
|
-- Path of the configuration
|
2013-10-30 17:29:19 +01:00
|
|
|
conf_path = "/etc/ssowat/conf.json"
|
2013-10-20 17:24:44 +02:00
|
|
|
|
|
|
|
ngx.log(ngx.INFO, "SSOwat ready")
|