fix: migrate support email

This commit is contained in:
zhouliang 2026-02-21 05:47:42 +08:00
parent fbaa238f43
commit bce4ea722b
2 changed files with 6 additions and 2 deletions

View file

@ -32,6 +32,7 @@ var supportedChannels = map[string]bool{
"qq": true, "qq": true,
"dingtalk": true, "dingtalk": true,
"maixcam": true, "maixcam": true,
"email": true,
} }
func findOpenClawConfig(openclawHome string) (string, error) { func findOpenClawConfig(openclawHome string) (string, error) {
@ -203,6 +204,9 @@ func ConvertConfig(data map[string]any) (*config.Config, []string, error) {
if v, ok := getFloat(cMap, "port"); ok { if v, ok := getFloat(cMap, "port"); ok {
cfg.Channels.MaixCam.Port = int(v) cfg.Channels.MaixCam.Port = int(v)
} }
case "email":
cfg.Channels.Email.Enabled = enabled
cfg.Channels.Email.AllowFrom = allowFrom
} }
} }
} }

View file

@ -234,7 +234,7 @@ func TestConvertConfig(t *testing.T) {
t.Run("unsupported channel warning", func(t *testing.T) { t.Run("unsupported channel warning", func(t *testing.T) {
data := map[string]any{ data := map[string]any{
"channels": map[string]any{ "channels": map[string]any{
"email": map[string]any{ "unknown_channel": map[string]any{
"enabled": true, "enabled": true,
}, },
}, },
@ -247,7 +247,7 @@ func TestConvertConfig(t *testing.T) {
if len(warnings) != 1 { if len(warnings) != 1 {
t.Fatalf("expected 1 warning, got %d", len(warnings)) t.Fatalf("expected 1 warning, got %d", len(warnings))
} }
if warnings[0] != "Channel 'email' not supported in PicoClaw, skipping" { if warnings[0] != "Channel 'unknown_channel' not supported in PicoClaw, skipping" {
t.Errorf("unexpected warning: %s", warnings[0]) t.Errorf("unexpected warning: %s", warnings[0])
} }
}) })