config.toml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # 通用配置
  2. [common]
  3. # 运行模式(debug:开发,test:测试,release:正式)
  4. run_mode = "debug"
  5. # HTTP Server
  6. [server]
  7. Address = ":18199"
  8. ServerAgent = "file-server"
  9. LogPath = "gf-app/server"
  10. # 请求读取超时时间
  11. ReadTimeout = "300s"
  12. # 客户端最大Body上传限制大小,默认为8*1024*1024=8MB
  13. ClientMaxBodySize = "1024MB"
  14. # 是否开启平滑重启特性,开启时将会在本地增加10000的本地TCP端口用于进程间通信。默认false
  15. Graceful = false
  16. # 静态服务配置
  17. # 开关
  18. FileServerEnable = false
  19. # 静态文件目录
  20. ServerRoot = ""
  21. # 默认首页检索
  22. IndexFiles = ["index.html"]
  23. # PProf配置
  24. # 是否开启PProf性能调试特性。默认为false
  25. PProfEnabled = false
  26. # 开启PProf时有效,表示PProf特性的页面访问路径,对当前Server绑定的所有域名有效。
  27. PProfPattern = ""
  28. # 反向代理的前缀, 如果有反向代理,则可以添加路由前缀
  29. RoutePrefix = ""
  30. # Logger.
  31. [logger]
  32. Path = "/tmp/log/gf-app"
  33. Level = "all"
  34. Stdout = true
  35. CtxKeys = ["user_id", "trace_id", "span_title", "span_function", "version"]
  36. # 请求频率限制(需要启用redis配置)
  37. [rate_limiter]
  38. # 是否启用
  39. enable = true
  40. # 每分钟每个用户允许的最大请求数量
  41. count = 10
  42. # redis数据库(如果存储方式是redis,则指定存储的数据库)
  43. redis_db = 10
  44. # 跨域请求
  45. [cors]
  46. # 是否启用
  47. enable = true
  48. # 允许跨域请求的域名列表(*表示全部允许)
  49. allow_origins = ["*"]
  50. # 允许跨域请求的请求方式列表
  51. allow_methods = ["GET","POST","PUT","DELETE","PATCH"]
  52. # 允许客户端与跨域请求一起使用的非简单标头的列表
  53. allow_headers = ["Access-Control-Allow-Origin"]
  54. # 请求是否可以包含cookie,HTTP身份验证或客户端SSL证书等用户凭据
  55. allow_credentials = true
  56. # 可以缓存预检请求结果的时间(以秒为单位)
  57. max_age = 7200
  58. # redis配置
  59. [redis]
  60. # 开关
  61. enable = true
  62. # 地址
  63. addr = "127.0.0.1:6379"
  64. # 密码
  65. password = ""
  66. # 默认库
  67. db = 0
  68. # mysql数据库配置
  69. [mysql]
  70. # 连接地址
  71. host = "127.0.0.1"
  72. # 连接端口
  73. port= 3306
  74. # 用户名
  75. user = "root"
  76. # 密码
  77. password = "lxl123456"
  78. # 数据库
  79. db_name = "file-server"
  80. # 连接参数
  81. parameters = "charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
  82. # gorm配置
  83. [gorm]
  84. # 设置连接可以重用的最长时间(单位:秒)
  85. max_lifetime = 7200
  86. # 设置数据库的最大打开连接数
  87. max_open_conns = 150
  88. # 设置空闲连接池中的最大连接数
  89. max_idle_conns = 50
  90. # 数据库表名前缀
  91. table_prefix = "m_"
  92. # 是否启用自动映射数据库表结构
  93. enable_auto_migrate = false
  94. # 慢查询阀值(单位:毫秒)
  95. slow_sql_limit = 2000
  96. # minio 配置
  97. [minio]
  98. addr = "127.0.0.1:9000"
  99. assess_key = "administrator"
  100. secret_key = "it2^wNKE$mVhr!hJozge@WauS"
  101. [agent]
  102. DefaultChunkExpireTime = 3600 #默认文件块的过期时间(秒)
  103. DefaultExpireTime = 1 # 默认临时文件过期时间(小时)
  104. DefaultFilePathPrefix = "s" # 默认文件上传路径前缀
  105. [corn]
  106. clear_chunk = "0 0 1 * * *"