[FIX]修改配置文件

This commit is contained in:
viletyy 2020-09-26 13:34:54 +08:00
parent 458672acd1
commit 5010beb901
3 changed files with 38 additions and 27 deletions

View File

@ -1,19 +1,29 @@
RUN_MODE = debug
[app]
PAGE_SIZE = 10
JWT_SECRET = 23347$040412
PageSize = 10
JwtSecret = 233
RuntimeRootPath = runtime/
ImagePrefixUrl = http://127.0.0.8002
ImageSavePath = upload/images/
ImageMaxSize = 5
ImageAllowExts = .jpg,.jpeg,.png
logSavePath = logs/
LogSaveName = log
LogFileExt = log
TimeFormat = 20060102
[server]
HTTP_PORT = 8002
READ_TIMEOUT = 60
WRITE_TIMEOUT = 60
RunMode = debug
HttpPort = 8002
ReadTimeout = 60
WriteTimeout = 60
[database]
TYPE = postgres
USER = virus
PASSWORD = a19960425
HOST = 0.0.0.0
PORT = 5432
NAME = shop
TABLE_PREFIX = shop_
Type = postgres
User = virus
Password = a19960425
Host = 0.0.0.0
Port = 5432
Name = shop
TablePrefix = shop_

View File

@ -29,13 +29,13 @@ func init() {
log.Fatal(2, "Fail to get section 'database': %v", err)
}
dbType = sec.Key("TYPE").String()
dbName = sec.Key("NAME").String()
user = sec.Key("USER").String()
password = sec.Key("PASSWORD").String()
host = sec.Key("HOST").String()
port = sec.Key("PORT").String()
tablePrefix = sec.Key("TABLE_PREFIX").String()
dbType = sec.Key("Type").String()
dbName = sec.Key("Name").String()
user = sec.Key("User").String()
password = sec.Key("Password").String()
host = sec.Key("Host").String()
port = sec.Key("Port").String()
tablePrefix = sec.Key("TablePrefix").String()
db, err = gorm.Open(dbType, fmt.Sprintf("host=%s user=%s dbname=%s port=%s sslmode=disable password=%s",
host,

View File

@ -29,7 +29,7 @@ func init() {
}
func LoadBase() {
RunMode = Cfg.Section("").Key("RUN_MODE").MustString("debug")
//RunMode = Cfg.Section("server").Key("RUN_MODE").MustString("debug")
}
func LoadServer() {
@ -38,9 +38,10 @@ func LoadServer() {
log.Fatalf("Fail to get section 'sever' : %v", err)
}
HTTPPort = sec.Key("HTTP_PORT").MustInt(8000)
ReadTimeout = time.Duration(sec.Key("READ_TIMEOUT").MustUint(60)) * time.Second
WriteTimeout = time.Duration(sec.Key("WRITE_TIMEOUT").MustInt(60)) * time.Second
RunMode = sec.Key("RunMode").MustString("debug")
HTTPPort = sec.Key("HttpPort").MustInt(8000)
ReadTimeout = time.Duration(sec.Key("ReadTimeout").MustUint(60)) * time.Second
WriteTimeout = time.Duration(sec.Key("WriteTimeout").MustInt(60)) * time.Second
}
func LoadApp() {
@ -49,6 +50,6 @@ func LoadApp() {
log.Fatalf("Fail to get section 'app':%v", err)
}
JwtSecret = sec.Key("JWT_SECRET").MustString("!@#!@#!@#!@@#!@#")
PageSize = sec.Key("PAGE_SIZE").MustInt(10)
JwtSecret = sec.Key("JwtSecret").MustString("!@#!@#!@#!@@#!@#")
PageSize = sec.Key("WriteTimeout").MustInt(10)
}