Skip to content

Commit 88abbc2

Browse files
committed
更新配置文件的统一化,并修改zap的level为info
1 parent 28f03c3 commit 88abbc2

File tree

3 files changed

+30
-37
lines changed

3 files changed

+30
-37
lines changed

server/config.yaml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,33 +84,26 @@ captcha:
8484
img-width: 240
8585
img-height: 80
8686

87-
# logger configuration
88-
log:
89-
prefix: '[GIN-VUE-ADMIN]'
90-
log-file: true
91-
stdout: 'DEBUG'
92-
file: 'DEBUG'
93-
9487
# zap logger configuration
9588
zap:
9689
# 可使用 "debug", "info", "warn", "error", "dpanic", "panic", "fatal",
97-
level: 'debug'
90+
level: 'info'
9891
# console: 控制台, json: json格式输出
9992
format: 'console'
10093
prefix: '[GIN-VUE-ADMIN]'
10194
director: 'log'
102-
link_name: 'latest_log'
103-
show_line: true
95+
link-name: 'latest_log'
96+
show-line: true
10497
# LowercaseLevelEncoder:小写, LowercaseColorLevelEncoder:小写带颜色,CapitalLevelEncoder: 大写, CapitalColorLevelEncoder: 大写带颜色,
105-
encode_level: 'LowercaseColorLevelEncoder'
106-
stacktrace_key: 'stacktrace'
107-
log_in_console: true
98+
encode-level: 'LowercaseColorLevelEncoder'
99+
stacktrace-key: 'stacktrace'
100+
log-in-console: true
108101

109102
email:
110-
email_from: '[email protected]'
111-
email_nick_name: 'test'
112-
email_secret: 'xxx'
113-
email_to: '[email protected]'
114-
email_host: 'smtp.163.com'
115-
email_port: 465
116-
email_isSSL: true
103+
email-from: '[email protected]'
104+
email-nickname: 'test'
105+
email-secret: 'xxx'
106+
email-to: '[email protected]'
107+
email-host: 'smtp.163.com'
108+
email-port: 465
109+
email-isSSL: true

server/config/config.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ type Redis struct {
7979
}
8080

8181
type LocalUpload struct {
82-
Local bool `mapstructure:"local" json:"local" yaml:"local"`
83-
FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
82+
Local bool `mapstructure:"local" json:"local" yaml:"local"`
83+
FilePath string `mapstructure:"file-path" json:"filePath" yaml:"file-path"`
8484
}
8585

8686
type Qiniu struct {
@@ -101,19 +101,19 @@ type Zap struct {
101101
Format string `mapstructure:"format" json:"format" yaml:"format"`
102102
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
103103
Director string `mapstructure:"director" json:"director" yaml:"director"`
104-
LinkName string `mapstructure:"link_name" json:"linkName" yaml:"link_name"`
105-
ShowLine bool `mapstructure:"show_line" json:"showLine" yaml:"showLine"`
106-
EncodeLevel string `mapstructure:"encode_level" json:"encodeLevel" yaml:"encode_level"`
107-
StacktraceKey string `mapstructure:"stacktrace_key" json:"stacktraceKey" yaml:"stacktrace_key"`
108-
LogInConsole bool `mapstructure:"log_in_console" json:"logInConsole" yaml:"log_in_console"`
104+
LinkName string `mapstructure:"link-name" json:"linkName" yaml:"link-name"`
105+
ShowLine bool `mapstructure:"show-line" json:"showLine" yaml:"showLine"`
106+
EncodeLevel string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"`
107+
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"`
108+
LogInConsole bool `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"`
109109
}
110110

111111
type Email struct {
112-
EmailFrom string `mapstructure:"email_from" json:"emailFrom" yaml:"email_from"`
113-
EmailNickName string `mapstructure:"email_nick_name" json:"emailNickName" yaml:"email_nick_name"`
114-
EmailSecret string `mapstructure:"email_secret" json:"emailSecret" yaml:"email_secret"`
115-
EmailTo string `mapstructure:"email_to" json:"emailTo" yaml:"email_to"`
116-
EmailHost string `mapstructure:"email_host" json:"emailHost" yaml:"email_host"`
117-
EmailPort int `mapstructure:"email_port" json:"emailPort" yaml:"email_port"`
118-
EmailIsSSL bool `mapstructure:"email_isSSL" json:"emailIsSSL" yaml:"email_isSSL"`
112+
EmailFrom string `mapstructure:"email-from" json:"emailFrom" yaml:"email-from"`
113+
EmailNickname string `mapstructure:"email-nickname" json:"emailNickname" yaml:"email-nickname"`
114+
EmailSecret string `mapstructure:"email-secret" json:"emailSecret" yaml:"email-secret"`
115+
EmailTo string `mapstructure:"email-to" json:"emailTo" yaml:"email-to"`
116+
EmailHost string `mapstructure:"email-host" json:"emailHost" yaml:"email-host"`
117+
EmailPort int `mapstructure:"email-port" json:"emailPort" yaml:"email-port"`
118+
EmailIsSSL bool `mapstructure:"email-is-ssl" json:"emailIsSSL" yaml:"email-is-ssl"`
119119
}

server/utils/email.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ func EmailTest(subject string, body string) error {
2323

2424
func send(to []string, subject string, body string) error {
2525
from := global.GVA_CONFIG.Email.EmailFrom
26-
nickName := global.GVA_CONFIG.Email.EmailNickName
26+
nickname := global.GVA_CONFIG.Email.EmailNickname
2727
secret := global.GVA_CONFIG.Email.EmailSecret
2828
host := global.GVA_CONFIG.Email.EmailHost
2929
port := global.GVA_CONFIG.Email.EmailPort
3030
isSSL := global.GVA_CONFIG.Email.EmailIsSSL
3131

3232
auth := smtp.PlainAuth("", from, secret, host)
3333
e := email.NewEmail()
34-
if nickName != "" {
35-
e.From = fmt.Sprintf("%s <%s>", nickName, from)
34+
if nickname != "" {
35+
e.From = fmt.Sprintf("%s <%s>", nickname, from)
3636
} else {
3737
e.From = from
3838
}

0 commit comments

Comments
 (0)