Apache Casbin Gateway
5. 运维

5.1 设置与配置

所有配置都是可选的。设置在设置页改,存在数据库里,所以不需要手工编辑文件,也不需要重启。

文件和页面的关系

可执行文件旁边的conf/app.conf只在第一次启动时给设置播种,并且逐项写了说明。一键安装的目录里没有这个文件,改用编译进二进制的那份来播种。

第一次启动之后再改这个文件不起作用——除了那几个在数据库打开之前就要读的键:

httpport、driverName、dataSourceName、dbName、redisEndpoint。

真正会被改的那些

设置默认作用
httpport17000Web界面和REST API的端口
httpaddr127.0.0.1Web界面绑定的网卡——见5.2
driverName / dataSourceNamesqlite / ./data/casbin-gateway.db数据存在哪
llmRecordModefull每个转发请求保留多少——4.2
providerProbeModeauto供应商是自动探测、只在要求时探测(manual),还是从不探测(off)——3.4
apiKeyEncryptionKey空用AES-256-GCM加密落盘的供应商API Key
casdoorEndpoint空把登录切换到Casdoor单点登录

设置页逐节说明

小节内容
开机自启动登录这台机器时要不要启动Gateway。托盘菜单的Start at Login是同一个开关
LLM记录记录模式和相关限制——4.2
渠道探测探测模式,以及报告多久过期——3.4
AgentAgent状态目录、保留多少条活动记录、监控轮询间隔
登录Casdoor的五个字段;留空则用Gateway自己的用户表
安全apiKeyEncryptionKey和中继令牌——5.2
网络出站SOCKS5代理、允许的主机名、允许的来源
备份配置快照——5.3
云同步把每份备份再存一份到这台机器之外——5.3
导入与导出把配置作为一个文件搬到另一台机器,或从那边读回来

用MySQL代替SQLite

用的是XORM,所以它支持的数据库都能用。把Gateway指向你的服务器,dbName不存在时会在第一次启动时创建:

driverName = mysql
dataSourceName = root:123@tcp(localhost:3306)/
dbName = casbin_gateway

接入Casdoor

Casdoor是可选的,接管成员管理。在一个Casdoor实例里为Gateway建好组织和应用,然后填设置→登录的五个字段。

只要casdoorEndpoint一填,登录就会跳转到Casdoor,同时也就启用了OAuth登录。

与其查文件,不如看结果

启动摘要会报告Gateway实际在做什么:用的哪个端口、哪个数据库、设置从哪来、中继要不要令牌(1.2)。

下一节:5.2 安全与对外提供服务。

在GitHub上编辑
Apache Incubator

Apache Casbin (Incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

Copyright © 2026 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.

Apache, Apache Casbin, the names of Apache projects, and the feather logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

本页内容