# lua-resty-casbin-adapter **Repository Path**: gridsoft/lua-resty-casbin-adapter ## Basic Information - **Project Name**: lua-resty-casbin-adapter - **Description**: No description available - **Primary Language**: Lua - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-12 - **Last Updated**: 2025-06-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README forked from https://github.com/tom2nonames/lua-resty-casbin-adapter ```lua local Enforcer = require("casbin") local Adapter = require("casbin.postgres") local pg_conf = { timeout = 1200, connect_config = { host = "127.0.0.1", port = 5432, database = "izw", schema = "public", user = "tom", password = "", max_packet_size = 1024 * 1024, charset = "utf8", application_name = "iot", ssl = false, ssl_required = nil, socket_type = "nginx", -- "luasocket" application_name = "iot", }, pool_config = { max_idle_timeout = 20000, -- 20s pool_size = 50 -- connection pool size } } local a = Adapter:new(pg_conf, "casbin_rules") -- hostname, port are optional local e = Enforcer:new("/path/to/model.conf", a) --reates a new Casbin enforcer with the model.conf file and the database ``` 更新: 1. 修复了obj不能有`:`冒号的问题 2. 为 pg 增加了 schema 设置 3. 增加的初始化时的错误处理