diff --git a/access.lua b/access.lua index f6deff1..41830af 100644 --- a/access.lua +++ b/access.lua @@ -2,6 +2,7 @@ -- Load configuration -- cache = ngx.shared.cache +srvkey = cache:get("srvkey") oneweek = 60 * 60 * 24 * 7 cookies = {} local conf_file = assert(io.open(conf_path, "r"), "Configuration file is missing") diff --git a/init.lua b/init.lua index ad29c90..41f67d1 100644 --- a/init.lua +++ b/init.lua @@ -12,7 +12,7 @@ hige = require "hige" -- Set random key math.randomseed(os.time()) -srvkey = math.random(1111111, 9999999) +ngx.shared.cache:add("srvkey", math.random(1111111, 9999999)) -- Shared table flashs = {} @@ -20,6 +20,6 @@ login = {} logout = {} -- Path of the configuration -conf_path = '/etc/ssowat/conf.json' +conf_path = "/etc/ssowat/conf.json" ngx.log(ngx.INFO, "SSOwat ready")