refactor(config): 更新配置文件格式并添加新配置项

This commit is contained in:
piexlMax(奇淼
2025-08-06 13:47:09 +08:00
parent 76fe71a8dd
commit 7a69b88885

View File

@@ -2,107 +2,103 @@
# jwt configuration # jwt configuration
jwt: jwt:
signing-key: qmPlus signing-key: qmPlus
expires-time: 7d expires-time: 7d
buffer-time: 1d buffer-time: 1d
issuer: qmPlus issuer: qmPlus
# zap logger configuration # zap logger configuration
zap: zap:
level: info level: info
format: console format: console
prefix: "[github.com/flipped-aurora/gin-vue-admin/server]" prefix: "[github.com/flipped-aurora/gin-vue-admin/server]"
director: log director: log
show-line: true show-line: true
encode-level: LowercaseColorLevelEncoder encode-level: LowercaseColorLevelEncoder
stacktrace-key: stacktrace stacktrace-key: stacktrace
log-in-console: true log-in-console: true
retention-day: -1
# redis configuration # redis configuration
redis: redis:
db: 0 #是否使用redis集群模式
addr: 177.7.0.14:6379 useCluster: false
password: "" #使用集群模式addr和db默认无效
addr: 177.7.0.14:6379
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# redis-list configuration
redis-list:
- name: cache # 数据库的名称,注意: name 需要在 redis-list 中唯一
useCluster: false # 是否使用redis集群模式
addr: 177.7.0.14:6379 # 使用集群模式addr和db默认无效
password: ""
db: 0
clusterAddrs:
- "177.7.0.14:7000"
- "177.7.0.15:7001"
- "177.7.0.13:7002"
# mongo configuration # mongo configuration
mongo: mongo:
coll: '' coll: ''
options: '' options: ''
database: '' database: ''
username: '' username: ''
password: '' password: ''
min-pool-size: 0 auth-source: ''
max-pool-size: 100 min-pool-size: 0
socket-timeout-ms: 0 max-pool-size: 100
connect-timeout-ms: 0 socket-timeout-ms: 0
is-zap: false connect-timeout-ms: 0
hosts: is-zap: false
- host: '' hosts:
port: '' - host: ''
port: ''
# email configuration # email configuration
email: email:
to: xxx@qq.com to: xxx@qq.com
port: 465 port: 465
from: xxx@163.com from: xxx@163.com
host: smtp.163.com host: smtp.163.com
is-ssl: true is-ssl: true
secret: xxx secret: xxx
nickname: test nickname: test
# system configuration # system configuration
system: system:
env: public # Change to "develop" to skip authentication for development mode env: local # 修改为public可以关闭路由日志输出
addr: 8888 addr: 8888
db-type: mysql db-type: mysql
oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置 oss-type: local # 控制oss选择走本地还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
use-redis: false # 使用redis use-redis: false # 使用redis
use-mongo: false # 使用mongo use-mongo: false # 使用mongo
use-multipoint: false use-multipoint: false
# IP限制次数 一个小时15000次 # IP限制次数 一个小时15000次
iplimit-count: 15000 iplimit-count: 15000
# IP限制一个小时 # IP限制一个小时
iplimit-time: 3600 iplimit-time: 3600
# 路由全局前缀
router-prefix: ""
# 严格角色模式 打开后权限将会存在上下级关系
use-strict-auth: false
# captcha configuration # captcha configuration
captcha: captcha:
key-long: 6 key-long: 6
img-width: 240 img-width: 240
img-height: 80 img-height: 80
open-captcha: 0 # 0代表一直开启大于0代表限制次数 open-captcha: 0 # 0代表一直开启大于0代表限制次数
open-captcha-timeout: 3600 # open-captcha大于0时才生效 open-captcha-timeout: 3600 # open-captcha大于0时才生效
# mysql connect configuration # mysql connect configuration
# 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master # 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master
mysql: mysql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: "" path: ""
port: "" port: ""
config: "" config: ""
@@ -114,107 +110,174 @@ db-list:
log-mode: "" log-mode: ""
log-zap: false log-zap: false
# pgsql connect configuration
# 未初始化之前请勿手动修改数据库信息如果一定要手动初始化请看https://gin-vue-admin.com/docs/first_master
pgsql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
oracle:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
mssql:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
sqlite:
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
db-list:
- disable: true # 是否禁用
type: "" # 数据库的类型,目前支持mysql、pgsql、mssql、oracle
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
path: ""
port: ""
config: ""
db-name: ""
username: ""
password: ""
max-idle-conns: 10
max-open-conns: 100
log-mode: ""
log-zap: false
# local configuration # local configuration
local: local:
path: uploads/file path: uploads/file
store-path: uploads/file store-path: uploads/file
# autocode configuration # autocode configuration
autocode: autocode:
transfer-restart: true web: web/src
# root 自动适配项目根目录 root: "" # root 自动适配项目根目录, 请不要手动配置,他会在项目加载的时候识别出根路径
# 请不要手动配置,他会在项目加载的时候识别出根路径 server: server
root: "" module: 'github.com/flipped-aurora/gin-vue-admin/server'
server: /server ai-path: "" # AI服务路径
server-plug: /plugin/%s
server-api: /api/v1/%s
server-initialize: /initialize
server-model: /model/%s
server-request: /model/%s/request/
server-router: /router/%s
server-service: /service/%s
web: /web/src
web-api: /api
web-form: /view
web-table: /view
# qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址) # qiniu configuration (请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址)
qiniu: qiniu:
zone: ZoneHuaDong zone: ZoneHuaDong
bucket: "" bucket: ""
img-path: "" img-path: ""
use-https: false use-https: false
access-key: "" access-key: ""
secret-key: "" secret-key: ""
use-cdn-domains: false use-cdn-domains: false
# minio oss configuration
minio:
endpoint: yourEndpoint
access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName
use-ssl: false
base-path: ""
bucket-url: "http://host:9000/yourBucketName"
# aliyun oss configuration # aliyun oss configuration
aliyun-oss: aliyun-oss:
endpoint: yourEndpoint endpoint: yourEndpoint
access-key-id: yourAccessKeyId access-key-id: yourAccessKeyId
access-key-secret: yourAccessKeySecret access-key-secret: yourAccessKeySecret
bucket-name: yourBucketName bucket-name: yourBucketName
bucket-url: yourBucketUrl bucket-url: yourBucketUrl
base-path: yourBasePath base-path: yourBasePath
# tencent cos configuration # tencent cos configuration
tencent-cos: tencent-cos:
bucket: xxxxx-10005608 bucket: xxxxx-10005608
region: ap-shanghai region: ap-shanghai
secret-id: your-secret-id secret-id: your-secret-id
secret-key: your-secret-key secret-key: your-secret-key
base-url: https://gin.vue.admin base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# aws s3 configuration (minio compatible) # aws s3 configuration (minio compatible)
aws-s3: aws-s3:
bucket: xxxxx-10005608 bucket: xxxxx-10005608
region: ap-shanghai region: ap-shanghai
endpoint: "" endpoint: ""
s3-force-path-style: false s3-force-path-style: false
disable-ssl: false disable-ssl: false
secret-id: your-secret-id secret-id: your-secret-id
secret-key: your-secret-key secret-key: your-secret-key
base-url: https://gin.vue.admin base-url: https://gin.vue.admin
path-prefix: github.com/flipped-aurora/gin-vue-admin/server path-prefix: github.com/flipped-aurora/gin-vue-admin/server
# cloudflare r2 configuration
cloudflare-r2:
bucket: xxxx0bucket
base-url: https://gin.vue.admin.com
path: uploads
account-id: xxx_account_id
access-key-id: xxx_key_id
secret-access-key: xxx_secret_key
# huawei obs configuration # huawei obs configuration
hua-wei-obs: hua-wei-obs:
path: you-path path: you-path
bucket: you-bucket bucket: you-bucket
endpoint: you-endpoint endpoint: you-endpoint
access-key: you-access-key access-key: you-access-key
secret-key: you-secret-key secret-key: you-secret-key
# excel configuration # excel configuration
excel: excel:
dir: ./resource/excel/ dir: ./resource/excel/
# timer task db clear table # disk usage configuration
Timer: disk-list:
start: true - mount-point: "/"
spec: "@daily" # 定时任务详细配置参考 https://pkg.go.dev/github.com/robfig/cron/v3
detail:
- tableName: sys_operation_records
compareField: created_at
interval: 2160h
- tableName: jwt_blacklists
compareField: created_at
interval: 168h
# 跨域配置 # 跨域配置
# 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用 # 需要配合 server/initialize/router.go -> `Router.Use(middleware.CorsByRules())` 使用
cors: cors:
mode: whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝 mode: strict-whitelist # 放行模式: allow-all, 放行全部; whitelist, 白名单模式, 来自白名单内域名的请求添加 cors 头; strict-whitelist 严格白名单模式, 白名单外的请求一律拒绝
whitelist: whitelist:
- allow-origin: example1.com - allow-origin: example1.com
allow-headers: content-type allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
allow-methods: GET, POST allow-methods: POST, GET
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
- allow-origin: example2.com allow-credentials: true # 布尔值
allow-headers: content-type - allow-origin: example2.com
allow-methods: GET, POST allow-headers: content-type
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type allow-methods: GET, POST
allow-credentials: true # 布尔值 expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
allow-credentials: true # 布尔值
mcp:
name: GVA_MCP
version: v1.0.0
sse_path: /sse
message_path: /message
url_prefix: ''