You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.5 KiB
1.5 KiB
Casdoor 配置结构
配置定义
package config
import "github.com/zeromicro/go-zero/rest"
type Config struct {
rest.RestConf
MySQL MySQLConfig
Casdoor CasdoorConfig
JWT JWTConfig
}
type MySQLConfig struct {
Host string
Port int
Database string
Username string
Password string
}
type CasdoorConfig struct {
Endpoint string
ClientId string
ClientSecret string
Organization string
Application string
RedirectUrl string
JwtPublicKey string
}
type JWTConfig struct {
Secret string
Expire int64
}
YAML 配置示例
Name: devops-api
Host: 0.0.0.0
Port: 8888
Timeout: 30000
Log:
Mode: console
Level: info
MySQL:
Host: localhost
Port: 3306
Database: devops
Username: root
Password: ""
Casdoor:
Endpoint: https://casdoor.example.com
ClientId: your-client-id
ClientSecret: your-client-secret
Organization: built-in
Application: devops-app
RedirectUrl: http://localhost:8888/api/v1/auth/callback
JwtPublicKey: |
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJAJC1HiIAZAiU...
-----END CERTIFICATE-----
JWT:
Secret: your-32-char-secret-key-here
Expire: 86400
获取 Casdoor 配置
Client ID / Client Secret
- 登录 Casdoor 管理后台
- 进入 Applications 菜单
- 选择对应应用,复制 Client ID 和 Client Secret
JWT Public Key
- 进入 Certs 菜单
- 找到 built-in/cert-built-in
- 复制 Certificate 内容(包含 BEGIN/END)
Organization
- 默认使用
built-in - 或创建新的 Organization,使用其名称