server-handle.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #! /bin/bash
  2. rm -f ./core/server.go
  3. # 生成server.go文件, 添加Router.Static("/admin", "./resource/dist")这个代码
  4. touch ./core/server.go
  5. filename="./core/server.go"
  6. cat>"${filename}"<<EOF
  7. package core
  8. import (
  9. "fmt"
  10. "gin-vue-admin/global"
  11. "gin-vue-admin/initialize"
  12. "go.uber.org/zap"
  13. "time"
  14. )
  15. type server interface {
  16. ListenAndServe() error
  17. }
  18. func RunWindowsServer() {
  19. if global.GVA_CONFIG.System.UseMultipoint {
  20. // 初始化redis服务
  21. initialize.Redis()
  22. }
  23. Router := initialize.Routers()
  24. Router.Static("/form-generator", "./resource/page")
  25. Router.Static("/admin", "./resource/dist")
  26. //InstallPlugs(Router)
  27. // end 插件描述
  28. address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
  29. s := initServer(address, Router)
  30. // 保证文本顺序输出
  31. // In order to ensure that the text order output can be deleted
  32. time.Sleep(10 * time.Microsecond)
  33. global.GVA_LOG.Debug("server run success on ", zap.String("address", address))
  34. fmt.Printf("欢迎使用 Gin-Vue-Admin默认自动化文档地址:http://127.0.0.1%s/swagger/index.html\n 默认前端文件运行地址:http://127.0.0.1:8888/admin\n", address)
  35. global.GVA_LOG.Error(s.ListenAndServe().Error())
  36. }
  37. EOF
  38. rm -f ./config.yaml
  39. # 生成config.yaml文件, 用于docker-compose的使用
  40. touch ./config.yaml
  41. filename="./config.yaml"
  42. cat>"${filename}"<<EOF
  43. # Gin-Vue-Admin Global Configuration
  44. # casbin configuration
  45. casbin:
  46. model-path: './resource/rbac_model.conf'
  47. # jwt configuration
  48. jwt:
  49. signing-key: 'qmPlus'
  50. # mysql connect configuration
  51. mysql:
  52. username: root
  53. password: 'Aa@6447985'
  54. path: mysql
  55. db-name: 'qmPlus'
  56. config: 'charset=utf8mb4&parseTime=True&loc=Local'
  57. max-idle-conns: 10
  58. max-open-conns: 10
  59. log-mode: true
  60. #sqlite 配置
  61. sqlite:
  62. path: db.db
  63. log-mode: true
  64. config: 'loc=Asia/Shanghai'
  65. # oss configuration
  66. # 切换本地与七牛云上传,分配头像和文件路径
  67. localupload:
  68. local: false
  69. avatar-path: uploads/avatar
  70. file-path: uploads/file
  71. # 请自行七牛申请对应的 公钥 私钥 bucket 和 域名地址
  72. qiniu:
  73. access-key: '25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ'
  74. secret-key: 'pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY'
  75. bucket: 'qm-plus-img'
  76. img-path: 'http://qmplusimg.henrongyi.top'
  77. # redis configuration
  78. redis:
  79. addr: redis:6379
  80. password: ''
  81. db: 0
  82. # system configuration
  83. system:
  84. use-multipoint: true
  85. env: 'public' # Change to "develop" to skip authentication for development mode
  86. addr: 8888
  87. db-type: "mysql" # support mysql/sqlite
  88. # captcha configuration
  89. captcha:
  90. key-long: 6
  91. img-width: 240
  92. img-height: 80
  93. # zap logger configuration
  94. zap:
  95. # 可使用 "debug", "info", "warn", "error", "dpanic", "panic", "fatal",
  96. level: 'debug'
  97. # console: 控制台, json: json格式输出
  98. format: 'console'
  99. prefix: '[GIN-VUE-ADMIN]'
  100. director: 'log'
  101. link_name: 'latest_log'
  102. show_line: true
  103. # LowercaseLevelEncoder:小写, LowercaseColorLevelEncoder:小写带颜色,CapitalLevelEncoder: 大写, CapitalColorLevelEncoder: 大写带颜色,
  104. encode_level: 'LowercaseColorLevelEncoder'
  105. stacktrace_key: 'stacktrace'
  106. log_in_console: true
  107. EOF