(conf map[string]interface{})
| 1038 | } |
| 1039 | |
| 1040 | func 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 | |
| 1072 | func extractDingTalkConfig(conf map[string]interface{}) dto.AgentDingTalkConfig { |
| 1073 | result := dto.AgentDingTalkConfig{ |
no test coverage detected