Files
iotlcm/server/config/config_default.yaml
T

225 lines
11 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# config_default.yaml 配置文件
# @Link https://github.com/xiujiecn/xiu-admin
# @Copyright Copyright (c) 2025 LiXiujie
# @Author Lxj <xxx@example.com>
# @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
# 系统配置
system:
name: "IotLCM"
version: "1.0"
description: "IotLCM Server"
gfmode: "dev"
upload:
local:
path: "resource/upload"
workerDiagnostic:
enabled: false
batch:
allocate:
chunkSize: 5000
maxFileSize: 52428800
# 服务配置
server:
# 基本配置
address: ":8199"
# 接口文档
openapiPath: "/api.json" # OpenAPI接口文档地址
swaggerPath: "/swagger" # 内置SwaggerUI展示地址
# 静态服务配置
indexFiles: ["index.html","index.htm"] # 自动首页静态文件检索。默认为["index.html", "index.htm"]
indexFolder: false # 当访问静态文件目录时,是否展示目录下的文件列表。默认关闭,那么请求将返回403
serverRoot: "resource/public" # 静态文件服务的目录根路径,配置时自动开启静态文件服务。默认关闭
searchPaths: ["/resource/public"] # 提供静态文件服务时额外的文件搜索路径,当根路径找不到时则按照顺序在搜索目录查找。默认关闭
fileServerEnabled: true
# 文件上传配置
maxHeaderBytes: "20KB"
clientMaxBodySize: "200MB"
# 日志配置
logger:
path: "/app/logs" # 日志文件路径。默认为空,表示关闭,仅输出到终端
file: "{Y-m-d-H}.log" # 日志文件格式。默认为"{Y-m-d}.log"
prefix: "" # 日志内容输出前缀。默认为空
level: "dev" # 日志输出级别
timeFormat: "2006-01-02T15:04:05" # 自定义日志输出的时间格式,使用Golang标准的时间格式配置
ctxKeys: [] # 自定义Context上下文变量名称,自动打印Context的变量到日志中。默认为空
header: true # 是否打印日志的头信息。默认true
stdout: true # 日志是否同时输出到终端。默认true
rotateSize: 0 # 按照日志文件大小对文件进行滚动切分。默认为0,表示关闭滚动切分特性
rotateExpire: 0 # 按照日志文件时间间隔对文件滚动切分。默认为0,表示关闭滚动切分特性
rotateBackupLimit: 0 # 按照切分的文件数量清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除
rotateBackupExpire: 0 # 按照切分的文件有效期清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除
rotateBackupCompress: 0 # 滚动切分文件的压缩比(0-9)。默认为0,表示不压缩
rotateCheckInterval: "1h" # 滚动切分的时间检测间隔,一般不需要设置。默认为1小时
stdoutColorDisabled: false # 关闭终端的颜色打印。默认开启
writerColorEnable: false # 日志文件是否带上颜色。默认false,表示不带颜色
# JWT配置
jwt:
signingKey: "${JWT_SIGNING_KEY}"
expiresTime: 7d
bufferTime: 1d
issuer: xiujie # 发行人
# 验证码配置
captcha:
keyLong: 6
imgWidth: 240
imgHeight: 80
openCaptcha: 0
openCaptchaTimeout: 3600
# 预警通知配置。短信服务使用 iotlcm-sms,配置完整并 enabled=true 后才会真实发送。
warning:
expire:
# 系统默认套餐到期预警天数;必须满足 firstWarnDays > secondWarnDays > thirdWarnDays。
firstWarnDays: 30
secondWarnDays: 15
thirdWarnDays: 7
monthly:
# 每月15日09:00企业汇总;以下参数名已按阿里云审核通过的模板核实。
# JSON字符串值支持 {count}、{expireDate};部署时同步到实际使用的配置文件。
# 空值仍不发送短信,不影响站内系统通知;不复用验证码/通用流量预警模板。
currentMonthParamsTemplate: '{"card_num":"{count}","expire_date":"{expireDate}"}' # SMS_512596191
nextMonthParamsTemplate: '{"card_num":"{count}","expire_date":"{expireDate}"}' # SMS_512646156
sms:
enabled: false
# HTTP 接口地址;如果配置 grpcAddr,则优先走 gRPC。
url: "http://127.0.0.1:11190/api/v1/sms/send"
grpcAddr: "127.0.0.1:11200"
timeout: "5s"
routerId: 0
# 兼容当前 iotlcm-sms 协议:如果短信微服务没有内置供应商配置,可在这里透传。
# 阿里云 serviceType=1,腾讯云 serviceType=2。
serviceType: ""
regionId: ""
accessKeyId: "${ACCESS_KEY_ID}"
accessKeySecret: "${ACCESS_KEY_SECRET}"
sdkAppId: "${SDK_APP_ID}"
signName: "${SMS_SIGN_NAME}"
templateId: "${TEMPLATE_ID}"
# 阿里云模板参数通常需要 JSON;如果预警模板变量名是 content,可配置为 '{"content":{contentJson}}'。
# 腾讯云多参数模板可按实际顺序配置,例如 '{firstItem}|{count}'。
msgContentTemplate: ""
# 长期建议:短信平台签名、模板和密钥由短信微服务自行处理,lcm 只传手机号和聚合内容。
wechat:
enabled: false
appId: "${APP_ID}"
appSecret: "${APP_SECRET}"
templateId: "${TEMPLATE_ID}"
page: "pages/message/index"
timeout: "5s"
database:
legacyCard:
link: ""
debug: false
logger:
path: "/app/logs/sql"
level: "all"
stdout: true
default: # 分组名称,可自定义,默认为default
link: "${DB_DSN}"
debug: true #开启调试模式
charset: "utf8mb4" # (可选)数据库编码(如: utf8mb4/utf8/gbk/gb2312),一般设置为utf8mb4。默认为utf8。
dryRun: false #ORM空跑(只读不写)
maxIdle: 30 #连接池最大闲置的连接数
maxOpen: 100 #连接池最大打开的连接数
maxLifetime: 120 #(单位秒)连接对象可重复使用的时间长度
# 缓存配置
cache:
adapter: "redis" # 缓存适配器,支持:file|redis
fileDir: "resource/cache" # 缓存文件目录
# Redis 配置示例
redis:
# 单实例配置
default:
mode: "single" #redis模式,支持:single|cluster|sentinel
sentinelMasterName: "example-master" #哨兵模式主节点名称
address: 127.0.0.1:6379
db: 0
pass: "${REDIS_PASSWORD}"
minIdle: 5 #最小空闲连接数
maxIdle: 30 #允许闲置的最大连接数
maxActive: 5000 #最大活跃连接数
idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/2m/2d
ClientName: "SystemCache"
# Queue配置
queue:
type: "asynq" # 队列类型
asynq:
redis:
address: 127.0.0.1:6379
db: 0
pass: "${REDIS_PASSWORD}"
user:
concurrency: 10 # 最大同时执行的任务数量
logLevel: 4 # 日志级别 DebugLevel 1, InfoLevel 2, WarnLevel 3, ErrorLevel 4, FatalLevel 5
# 路由配置
router:
# 不需要验证登录的路由地址
exceptLogin:
- /api/v1/system/auth/login
- /api/v1/system/auth/refresh
- /api/v1/system/captcha
- /api/v1/system/auth/getTenantList
- /api/v1/system/auth/sms-code
- /api/v1/system/auth/sms-login
# 生成代码
xgen:
allowedIPs: [ "127.0.0.1", "*" ] # 白名单,*代表所有,只有允许的IP后台才能使用生成代码功能
selectDbs: [ "default" ] # 可选生成表的数据库配置名称,支持多库
disableTables: [ ] # 禁用的表,禁用以后将不会在选择表中看到
delimiters: [ "@{", "}" ] # 模板引擎变量分隔符号
# 生成应用模型,所有生成模板允许自定义,可以参考default模板进行改造
application:
# CRUD和关系树列表模板
crud:
templates:
# 默认的主包模板
- group: "default" # 分组名称
isAddon: false # 是否为插件模板 false|true
masterPackage: "gen" # 主包名称,需和controllerPath、logicPath、inputPath保持关联
templatePath: "./resource/generate/default/curd" # 模板路径
apiPath: "./api/gen/v1/" # goApi生成路径
controllerPath: "./internal/controller/gen" # 控制器生成路径
logicPath: "./internal/logic/gen" # 主要业务生成路径
inputPath: "./internal/model/genin" # 表单过滤器生成路径
routerPath: "./internal/router/genrouter" # 生成路由表路径
sqlPath: "./manifest/generate" # 生成sql语句路径
webApiPath: "./web/generate/api" # webApi生成路径
webViewsPath: "./web/generate/views" # web页面生成路径
# 默认的插件包模板,{$name}会自动替换成实际的插件名称
- group: "addon" # 分组名称
isAddon: true # 是否为插件模板 false|true
masterPackage: "sys" # 主包名称,需和controllerPath、logicPath、inputPath保持关联
templatePath: "./resource/generate/default/curd" # 模板路径
apiPath: "./addons/{$name}/api/admin" # goApi生成路径
controllerPath: "./addons/{$name}/controller/admin/sys" # 控制器生成路径
logicPath: "./addons/{$name}/logic/sys" # 主要业务生成路径
inputPath: "./addons/{$name}/model/input/sysin" # 表单过滤器生成路径
routerPath: "./addons/{$name}/router/genrouter" # 生成路由表路径
sqlPath: "./storage/data/generate/addons" # 生成sql语句路径
webApiPath: "../web/src/api/addons/{$name}" # webApi生成路径
webViewsPath: "../web/src/views/addons/{$name}" # web页面生成路径
upstream:
proxy:
# address: "yzupstreamproxy-http-svc"
address: "localhost:8510"
timeout: 10s
gateway:
# address: "iotlcmupstreamchan-http-svc"
address: "localhost:8110"
timeout: 10s