日志发送逻辑及测试消息发送接口
This commit is contained in:
@@ -41,6 +41,9 @@ type Config struct {
|
||||
|
||||
// LoraMesh LoraMesh配置
|
||||
LoraMesh LoraMeshConfig `yaml:"lora_mesh"`
|
||||
|
||||
// Notify 通知服务配置
|
||||
Notify NotifyConfig `yaml:"notify"`
|
||||
}
|
||||
|
||||
// AppConfig 代表应用基础配置
|
||||
@@ -158,6 +161,40 @@ type LoraMeshConfig struct {
|
||||
ReassemblyTimeout int `yaml:"reassembly_timeout"`
|
||||
}
|
||||
|
||||
// NotifyConfig 包含了所有与通知服务相关的配置
|
||||
type NotifyConfig struct {
|
||||
Primary string `yaml:"primary"` // 首选通知渠道 (e.g., "smtp", "wechat", "lark", "log")
|
||||
FailureThreshold int `yaml:"failureThreshold"` // 连续失败多少次后触发广播模式
|
||||
SMTP SMTPConfig `yaml:"smtp"`
|
||||
WeChat WeChatConfig `yaml:"wechat"`
|
||||
Lark LarkConfig `yaml:"lark"`
|
||||
}
|
||||
|
||||
// SMTPConfig SMTP邮件配置
|
||||
type SMTPConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Host string `yaml:"host"`
|
||||
Port int `yaml:"port"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
Sender string `yaml:"sender"`
|
||||
}
|
||||
|
||||
// WeChatConfig 企业微信应用配置
|
||||
type WeChatConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
CorpID string `yaml:"corpID"`
|
||||
AgentID string `yaml:"agentID"`
|
||||
Secret string `yaml:"secret"`
|
||||
}
|
||||
|
||||
// LarkConfig 飞书应用配置
|
||||
type LarkConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
AppID string `yaml:"appID"`
|
||||
AppSecret string `yaml:"appSecret"`
|
||||
}
|
||||
|
||||
// NewConfig 创建并返回一个新的配置实例
|
||||
func NewConfig() *Config {
|
||||
// 默认值可以在这里设置,但我们优先使用配置文件中的值
|
||||
|
||||
Reference in New Issue
Block a user