MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / extractWecomConfig

Function extractWecomConfig

agent/app/service/agents_channels.go:1040–1070  ·  view source on GitHub ↗
(conf map[string]interface{})

Source from the content-addressed store, hash-verified

1038}
1039
1040func extractWecomConfig(conf map[string]interface{}) dto.AgentWecomConfig {
1041 result := dto.AgentWecomConfig{
1042 Enabled: true,
1043 DmPolicy: "pairing",
1044 AllowFrom: []string{},
1045 GroupPolicy: "open",
1046 GroupAllowFrom: []string{},
1047 }
1048 channels, ok := conf["channels"].(map[string]interface{})
1049 if !ok {
1050 return result
1051 }
1052 wecom, ok := channels["wecom"].(map[string]interface{})
1053 if !ok {
1054 return result
1055 }
1056 if enabled, ok := wecom["enabled"].(bool); ok {
1057 result.Enabled = enabled
1058 }
1059 if dmPolicy := extractStringValue(wecom["dmPolicy"]); dmPolicy != "" {
1060 result.DmPolicy = dmPolicy
1061 }
1062 result.AllowFrom = extractStringList(wecom["allowFrom"])
1063 if groupPolicy := extractStringValue(wecom["groupPolicy"]); groupPolicy != "" {
1064 result.GroupPolicy = groupPolicy
1065 }
1066 result.GroupAllowFrom = extractStringList(wecom["groupAllowFrom"])
1067 result.BotID = extractStringValue(wecom["botId"])
1068 result.Secret = extractStringValue(wecom["secret"])
1069 return result
1070}
1071
1072func extractDingTalkConfig(conf map[string]interface{}) dto.AgentDingTalkConfig {
1073 result := dto.AgentDingTalkConfig{

Callers 1

GetWecomConfigMethod · 0.85

Calls 2

extractStringValueFunction · 0.85
extractStringListFunction · 0.85

Tested by

no test coverage detected