Feat: sign http request / read running mode from config file

This commit is contained in:
HFO4
2019-12-23 13:27:18 +08:00
parent fd7b6e33c8
commit 90827b2441
13 changed files with 199 additions and 45 deletions

View File

@@ -18,8 +18,11 @@ type database struct {
// system 系统通用配置
type system struct {
Mode string `validate:"eq=master|eq=slave"`
Listen string `validate:"required"`
Debug bool
SessionSecret string
SlaveSecret string `validate:"omitempty,gte=64"`
}
// captcha 验证码配置
@@ -84,7 +87,7 @@ func Init(path string) {
for sectionName, sectionStruct := range sections {
err = mapSection(sectionName, sectionStruct)
if err != nil {
util.Log().Warning("配置文件 %s 分区解析失败: %s", sectionName, err)
util.Log().Panic("配置文件 %s 分区解析失败: %s", sectionName, err)
}
}

View File

@@ -16,7 +16,9 @@ var DatabaseConfig = &database{
// SystemConfig 系统公用配置
var SystemConfig = &system{
Debug: false,
Debug: false,
Mode: "master",
Listen: ":5000",
}
// CaptchaConfig 验证码配置