From 66393b35f7692758680ceacaca9bb5d58de0b872 Mon Sep 17 00:00:00 2001 From: QM303176530 <303176530@qq.com> Date: Sun, 12 Apr 2020 13:34:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9sqlite=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E7=9A=84=E6=94=AF=E6=8C=81=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=A8=A1=E5=BC=8F=E4=B8=BAmysql=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 2 +- server/config/config.go | 14 +++++++------- server/main.go | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/server/config.yaml b/server/config.yaml index faf67f04..0f10318a 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -39,7 +39,7 @@ system: use-multipoint: false env: 'public' # Change to "develop" to skip authentication for development mode addr: 8888 - db-type: sqlite + db-type: "mysql" # captcha configuration captcha: diff --git a/server/config/config.go b/server/config/config.go index cb725086..39415a90 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -2,7 +2,7 @@ package config type Server struct { Mysql Mysql `mapstructure:"mysql" json:"mysql"` - Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite"` + Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite"` Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu"` Casbin Casbin `mapstructure:"casbin" json:"casbin"` Redis Redis `mapstructure:"redis" json:"redis"` @@ -16,7 +16,7 @@ type System struct { UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint"` Env string `mapstructure:"env" json:"env"` Addr int `mapstructure:"addr" json:"addr"` - DbType string `mapstructure:"db-type" json:"dbType"` + DbType string `mapstructure:"db-type" json:"dbType"` } type JWT struct { @@ -62,9 +62,9 @@ type Log struct { } type Sqlite struct { - Username string `mapstructure:"username" json:"username"` - Password string `mapstructure:"password" json:"password"` - Path string `mapstructure:"path" json:"path"` - Config string `mapstructure:"config" json:"config"` - LogMode bool `mapstructure:"log-mode" json:"logMode"` + Username string `mapstructure:"username" json:"username"` + Password string `mapstructure:"password" json:"password"` + Path string `mapstructure:"path" json:"path"` + Config string `mapstructure:"config" json:"config"` + LogMode bool `mapstructure:"log-mode" json:"logMode"` } diff --git a/server/main.go b/server/main.go index ff4f57cd..7f97b3b8 100644 --- a/server/main.go +++ b/server/main.go @@ -8,11 +8,13 @@ import ( ) func main() { - switch global.GVA_CONFIG.System.DbType { + switch global.GVA_CONFIG.System.DbType { case "mysql": initialize.Mysql() case "sqlite": initialize.Sqlite() + default: + initialize.Mysql() } initialize.DBTables() // 程序结束前关闭数据库链接