Browse Source

feat: 系统配置界面增加sqlite 配置

main
rikugun 5 years ago
parent
commit
059c0ff56d
  1. 2
      server/config.yaml
  2. 2
      server/config/config.go
  3. BIN
      server/db/db.db
  4. 2
      server/main.go
  5. 65
      web/src/view/systemTools/system/system.vue

2
server/config.yaml

@ -39,7 +39,7 @@ system:
use-multipoint: false use-multipoint: false
env: 'public' # Change to "develop" to skip authentication for development mode env: 'public' # Change to "develop" to skip authentication for development mode
addr: 8888 addr: 8888
db: sqlite
db-type: sqlite
# captcha configuration # captcha configuration
captcha: captcha:

2
server/config/config.go

@ -16,7 +16,7 @@ type System struct {
UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint"` UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint"`
Env string `mapstructure:"env" json:"env"` Env string `mapstructure:"env" json:"env"`
Addr int `mapstructure:"addr" json:"addr"` Addr int `mapstructure:"addr" json:"addr"`
Db string `mapstructure:"db" json:"db"`
DbType string `mapstructure:"db-type" json:"dbType"`
} }
type JWT struct { type JWT struct {

BIN
server/db/db.db

2
server/main.go

@ -8,7 +8,7 @@ import (
) )
func main() { func main() {
switch global.GVA_CONFIG.System.Db {
switch global.GVA_CONFIG.System.DbType {
case "mysql": case "mysql":
initialize.Mysql() initialize.Mysql()
case "sqlite": case "sqlite":

65
web/src/view/systemTools/system/system.vue

@ -11,6 +11,12 @@
<el-form-item label="端口值"> <el-form-item label="端口值">
<el-input v-model="config.system.addr"></el-input> <el-input v-model="config.system.addr"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="数据库类型">
<el-select v-model="config.system.dbType">
<el-option value="sqlite"></el-option>
<el-option value="mysql"></el-option>
</el-select>
</el-form-item>
<h2>jwt签名</h2> <h2>jwt签名</h2>
<el-form-item label="jwt签名"> <el-form-item label="jwt签名">
<el-input v-model="config.jwt.signingKey"></el-input> <el-input v-model="config.jwt.signingKey"></el-input>
@ -19,28 +25,42 @@
<el-form-item label="模型地址"> <el-form-item label="模型地址">
<el-input v-model="config.casbin.modelPath"></el-input> <el-input v-model="config.casbin.modelPath"></el-input>
</el-form-item> </el-form-item>
<h2>mysql admin数据库配置</h2>
<el-form-item label="username">
<el-input v-model="config.mysql.username"></el-input>
</el-form-item>
<el-form-item label="password">
<el-input v-model="config.mysql.password"></el-input>
</el-form-item>
<el-form-item label="path">
<el-input v-model="config.mysql.path"></el-input>
</el-form-item>
<el-form-item label="dbname">
<el-input v-model="config.mysql.dbname"></el-input>
</el-form-item>
<el-form-item label="maxIdleConns">
<el-input v-model.number="config.mysql.maxIdleConns"></el-input>
</el-form-item>
<el-form-item label="maxOpenConns">
<el-input v-model.number="config.mysql.maxOpenConns"></el-input>
</el-form-item>
<el-form-item label="logMode">
<el-checkbox v-model="config.log.logMode"></el-checkbox>
</el-form-item>
<template v-show="config.system.dbType == 'mysql'">
<h2>mysql admin数据库配置</h2>
<el-form-item label="username">
<el-input v-model="config.mysql.username"></el-input>
</el-form-item>
<el-form-item label="password">
<el-input v-model="config.mysql.password"></el-input>
</el-form-item>
<el-form-item label="path">
<el-input v-model="config.mysql.path"></el-input>
</el-form-item>
<el-form-item label="dbname">
<el-input v-model="config.mysql.dbname"></el-input>
</el-form-item>
<el-form-item label="maxIdleConns">
<el-input v-model.number="config.mysql.maxIdleConns"></el-input>
</el-form-item>
<el-form-item label="maxOpenConns">
<el-input v-model.number="config.mysql.maxOpenConns"></el-input>
</el-form-item>
<el-form-item label="logMode">
<el-checkbox v-model="config.log.logMode"></el-checkbox>
</el-form-item>
</template>
<template v-show="config.system.dbType == 'sqlite'">
<h2>sqlite admin数据库配置</h2>
<el-form-item label="path">
<el-input v-model="config.sqlite.path"></el-input>
</el-form-item>
<el-form-item label="config">
<el-input v-model="config.sqlite.config"></el-input>
</el-form-item>
<el-form-item label="logMode">
<el-checkbox v-model="config.sqlite.logMode"></el-checkbox>
</el-form-item>
</template>
<h2>Redis admin数据库配置</h2> <h2>Redis admin数据库配置</h2>
<el-form-item label="addr"> <el-form-item label="addr">
<el-input v-model="config.redis.addr"></el-input> <el-input v-model="config.redis.addr"></el-input>
@ -104,6 +124,7 @@ export default {
jwt: {}, jwt: {},
casbin: {}, casbin: {},
mysql: {}, mysql: {},
sqlite: {},
redis: {}, redis: {},
qiniu: {}, qiniu: {},
captcha:{}, captcha:{},

Loading…
Cancel
Save