You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
359 B
Lua

local mongo = require "resty.mongol"
local cjson = require "cjson"
local _M = {}
function _M.new(self, cnf)
local conn = mongo:new()
conn:set_timeout(10000)
local ok, err = conn:connect(cnf.ip, cnf.port)
if not ok then
ngx.log(ngx.INFO,"mongo connect err = ", err)
return nil, err
end
return conn, nil
end
return _M