配置文件详解

配置文件详解

MLiev IAM 使用 config.yaml 作为主配置文件。

app — 系统配置

app:
  installed: false  # 安装向导完成后自动设为 true

server — 服务器配置

server:
  mode: release   # debug / release / test
  addr: ":8080"   # 监听地址

database — 数据库配置

database:
  driver: mysql              # mysql / postgresql / sqlite
  host: localhost
  port: 3306
  username: root
  password: password
  database: mliev_iam
  charset: utf8mb4           # 仅 MySQL
  max_idle_conns: 10
  max_open_conns: 100
  conn_max_lifetime: 3600
  # SQLite
  filepath: "./data/mliev_iam.db"

redis — Redis 配置

redis:
  host: localhost
  port: 6379
  password: ""
  db: 0
  pool_size: 10
  min_idle_conns: 5

cache — 缓存配置

cache:
  driver: memory  # redis / memory / none

log — 日志配置

log:
  level: info
  filename: logs/app.log
  max_size: 100     # MB
  max_age: 30       # 天
  max_backups: 10
  compress: true

jwt — JWT 配置

jwt:
  secret: your-secret-key
  expire_hours: 24

oidc — OIDC 配置

oidc:
  issuer: "http://localhost:8080"

  token_lifetime:
    access_token: 3600
    refresh_token: 2592000
    id_token: 3600
    authorization_code: 600

  features:
    pkce_enabled: true
    introspection_enabled: true
    revocation_enabled: true
    refresh_token_enabled: true

  defaults:
    scopes: ["openid", "profile", "email"]
    grant_types: ["authorization_code", "refresh_token"]
    client_type: "confidential"

  session:
    redis_key_prefix: "oidc:session:"
    expiration: 600

  security:
    max_authorization_attempts: 5
    max_client_failure_attempts: 10
    rate_limit_enabled: true

rate_limit — 限流

rate_limit:
  requests_per_minute: 100
  burst: 10

cors — 跨域

cors:
  allow_origins: ["*"]
  allow_methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
  allow_headers: ["Origin", "Content-Type", "Authorization"]

push — 消息推送

push:
  baseUrl: "https://push.mliev.com"
  appId: "your_app_id"
  appSecret: "your_app_secret"
  smsChannelId: 1
  emailChannelId: 2
  smsSignature: "【签名】"