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