mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-25 10:59:13 +08:00
fix(config): use web.AppConfig instead of adapter
- use web.AppConfig, and change related codes TODO: handles errors
This commit is contained in:
18
conf/mail.go
18
conf/mail.go
@@ -3,7 +3,7 @@ package conf
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/v2/adapter"
|
||||
"github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
type SmtpConf struct {
|
||||
@@ -19,14 +19,14 @@ type SmtpConf struct {
|
||||
}
|
||||
|
||||
func GetMailConfig() *SmtpConf {
|
||||
user_name := adapter.AppConfig.String("smtp_user_name")
|
||||
password := adapter.AppConfig.String("smtp_password")
|
||||
smtp_host := adapter.AppConfig.String("smtp_host")
|
||||
smtp_port := adapter.AppConfig.DefaultInt("smtp_port", 25)
|
||||
form_user_name := adapter.AppConfig.String("form_user_name")
|
||||
enable_mail := adapter.AppConfig.String("enable_mail")
|
||||
mail_number := adapter.AppConfig.DefaultInt("mail_number", 5)
|
||||
secure := adapter.AppConfig.DefaultString("secure", "NONE")
|
||||
user_name, _ := web.AppConfig.String("smtp_user_name")
|
||||
password, _ := web.AppConfig.String("smtp_password")
|
||||
smtp_host, _ := web.AppConfig.String("smtp_host")
|
||||
smtp_port := web.AppConfig.DefaultInt("smtp_port", 25)
|
||||
form_user_name, _ := web.AppConfig.String("form_user_name")
|
||||
enable_mail, _ := web.AppConfig.String("enable_mail")
|
||||
mail_number := web.AppConfig.DefaultInt("mail_number", 5)
|
||||
secure := web.AppConfig.DefaultString("secure", "NONE")
|
||||
|
||||
if secure != "NONE" && secure != "LOGIN" && secure != "SSL" {
|
||||
secure = "NONE"
|
||||
|
||||
Reference in New Issue
Block a user