Merge branches 'gin-vue-admin-adjust-log' and 'master' of https://github.com/piexlmax/QMPlus into gin-vue-admin-adjust-log
Conflicts: QMPlusServer/init/qmsql/initMysql.go QMPlusServer/main.go QMPlusVuePage/src/view/superAdmin/autoCode/index.vue
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.12 AS build
|
||||
|
||||
WORKDIR /go/src/gin-vue-admin
|
||||
COPY . .
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn
|
||||
RUN go get ./... \
|
||||
&& go build -o gin-vue-admin
|
||||
|
||||
FROM golang:1.12 AS serve
|
||||
|
||||
COPY --from=build /go/src/gin-vue-admin /go/src/gin-vue-admin
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [ "./gin-vue-admin" ]
|
||||
@@ -32,11 +32,14 @@ type CasbinConfig struct { //casbin配置
|
||||
}
|
||||
|
||||
type MysqlAdmin struct { // mysql admin 数据库配置
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Path string `json:"path"`
|
||||
Dbname string `json:"dbname"`
|
||||
Config string `json:"config"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Path string `json:"path"`
|
||||
Dbname string `json:"dbname"`
|
||||
Config string `json:"config"`
|
||||
MaxIdleConns int `json:"maxIdleConns"`
|
||||
MaxOpenConns int `json:"maxOpenConns"`
|
||||
LogMode bool `json:"maxOpenConns"`
|
||||
}
|
||||
|
||||
type RedisAdmin struct { // Redis admin 数据库配置
|
||||
|
||||
@@ -15,8 +15,9 @@ func InitMysql(admin config.MysqlAdmin) *gorm.DB {
|
||||
log.L.Error("DEFAULTDB数据库启动异常",err)
|
||||
} else {
|
||||
DEFAULTDB = db
|
||||
DEFAULTDB.DB().SetMaxIdleConns(10)
|
||||
DEFAULTDB.DB().SetMaxOpenConns(100)
|
||||
DEFAULTDB.DB().SetMaxIdleConns(admin.MaxIdleConns)
|
||||
DEFAULTDB.DB().SetMaxOpenConns(admin.MaxOpenConns)
|
||||
DEFAULTDB.LogMode(admin.LogMode)
|
||||
}
|
||||
return DEFAULTDB
|
||||
}
|
||||
|
||||
+14
-1
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"fmt"
|
||||
"gin-vue-admin/cmd"
|
||||
"gin-vue-admin/config"
|
||||
@@ -20,12 +22,23 @@ import (
|
||||
// @name x-token
|
||||
// @BasePath /
|
||||
|
||||
var (
|
||||
mysqlHost = os.Getenv("MYSQLHOST")
|
||||
mysqlPort = os.Getenv("MYSQLPORT")
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err:= qmlog.NewLogger(); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
// 可以通过环境变量来覆盖配置值
|
||||
// 未设定有效的环境变量时,使用配置值
|
||||
mysqlConfig := config.GinVueAdminconfig.MysqlAdmin
|
||||
if mysqlHost != "" && mysqlPort != "" {
|
||||
mysqlConfig.Path = mysqlHost + ":" + mysqlPort
|
||||
}
|
||||
// 链接初始化数据库
|
||||
db := qmsql.InitMysql(config.GinVueAdminconfig.MysqlAdmin)
|
||||
db := qmsql.InitMysql(mysqlConfig) // 链接初始化数据库
|
||||
if config.GinVueAdminconfig.System.UseMultipoint {
|
||||
// 初始化redis服务
|
||||
_ = initRedis.InitRedis()
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package autoCodeModel
|
||||
|
||||
//开发中功能,若您发现这块代码可以研究,可以无视
|
||||
type AutoCodeStruct struct {
|
||||
StructName string `json:"structName"`
|
||||
StructType []string `json:"structType"`
|
||||
Components []Component `json:"components"`
|
||||
}
|
||||
|
||||
type Component struct {
|
||||
ComponentName string `json:"componentName"`
|
||||
ComponentType string `json:"componentType"`
|
||||
Ismultiple bool `json:"isMultiple"`
|
||||
ComponentShowType string `json:"componentShowType"`
|
||||
NideDictionary bool `json:"nideDictionary"`
|
||||
DictionaryName string `json:"dictionaryName"`
|
||||
ComponentDictionary []Dictionary `json:"dictionary"`
|
||||
}
|
||||
|
||||
type Dictionary struct {
|
||||
Label string `json:"label"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
@@ -10,7 +10,10 @@
|
||||
"password": "YINGL19980716.",
|
||||
"path": "127.0.0.1:3306",
|
||||
"dbname": "qmPlus",
|
||||
"config": "charset=utf8\u0026parseTime=True\u0026loc=Local"
|
||||
"config": "charset=utf8\u0026parseTime=True\u0026loc=Local",
|
||||
"maxIdleConns": 10,
|
||||
"maxOpenConns": 100,
|
||||
"logMode": true
|
||||
},
|
||||
"qiniu": {
|
||||
"accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ",
|
||||
|
||||
Reference in New Issue
Block a user