Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func initSigning(cfg *config.Config) error {
encryptionimpl.NewEncryptionImpl(),
pi,
)

cfg.Domain.Config.IsTestEnvironment = false // 强制生产环境

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

不建议在代码中硬编码配置项。IsTestEnvironment 的值应该通过配置文件或环境变量来管理,以保持不同环境(如开发、测试、生产)的灵活性。

硬编码此值会覆盖配置文件中的设置,可能导致在测试环境中出现意外行为(例如,无法使用固定的测试验证码),并使配置管理变得困难。

建议删除此行,并通过相应的环境配置文件来设置 IsTestEnvironment 的值。

vcService := vcservice.NewVCService(
repositoryimpl.NewVerificationCode(
mongodb.DAO(cfg.Mongodb.Collections.VerificationCode),
Expand Down
3 changes: 2 additions & 1 deletion signing/infrastructure/smtpimpl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ type Config struct {
func (cfg *Config) SetDefault() {
if cfg.Host == "" || cfg.Port <= 0 || cfg.Platform == "" {
cfg.Port = 465
cfg.Host = "smtp.exmail.qq.com"
// cfg.Host = "smtp.exmail.qq.com"
cfg.Host = "smtp.qq.com"
Comment on lines +19 to +20

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议删除已注释掉的代码行。版本控制系统(如 Git)可以用来追踪历史更改,因此在代码中保留注释掉的旧代码是不必要的,这会使代码显得混乱。

另外,修改默认的 SMTP 主机地址可能会影响依赖此默认值的现有部署。请确认此更改是否是有意为之,并已在所有相关环境中进行了测试。

Suggested change
// cfg.Host = "smtp.exmail.qq.com"
cfg.Host = "smtp.qq.com"
cfg.Host = "smtp.qq.com"

cfg.Platform = "smtp"
}
}
Expand Down
Loading