File tree 4 files changed +21
-17
lines changed
4 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,6 @@ endpoints:
55
55
56
56
rules :
57
57
hello_world :
58
- endpoints :
59
- - hello_world
60
58
` ` `
61
59
62
60
### Full Config
Original file line number Diff line number Diff line change @@ -217,10 +217,12 @@ func Read(cli CLI) (Raw, error) {
217
217
return Raw {}, err
218
218
}
219
219
220
- for k , v := range raw .Endpoints {
221
- if v .Body_Template == "" {
222
- v .Body_Template = `{{ .Message.Text }}`
223
- raw .Endpoints [k ] = v
220
+ for endKey := range raw .Endpoints {
221
+ for ruleKey , rrule := range raw .Rules {
222
+ if ruleKey == endKey {
223
+ rrule .Endpoints = append (rrule .Endpoints , endKey )
224
+ raw .Rules [ruleKey ] = rrule
225
+ }
224
226
}
225
227
}
226
228
File renamed without changes.
Original file line number Diff line number Diff line change @@ -32,24 +32,28 @@ type Endpoint struct {
32
32
Config map [string ]string
33
33
}
34
34
35
- func New (req CreateEndpoint ) (Endpoint , error ) {
36
- if req .Internal && req .InternalID == "" {
35
+ func New (r CreateEndpoint ) (Endpoint , error ) {
36
+ if r .Internal && r .InternalID == "" {
37
37
return Endpoint {}, fmt .Errorf ("internal id is empty" )
38
38
}
39
39
40
- if req .Name == "" {
40
+ if r .Name == "" {
41
41
return Endpoint {}, fmt .Errorf ("name is empty" )
42
42
}
43
43
44
+ if r .BodyTemplate == "" {
45
+ r .BodyTemplate = "{{ .Message.Text }}"
46
+ }
47
+
44
48
end := Endpoint {
45
- Internal : req .Internal ,
46
- InternalID : req .InternalID ,
47
- Name : req .Name ,
48
- AttachmentDisable : req .AttachmentDisable ,
49
- TextDisable : req .TextDisable ,
50
- BodyTemplate : req .BodyTemplate ,
51
- Kind : req .Kind ,
52
- Config : req .Config ,
49
+ Internal : r .Internal ,
50
+ InternalID : r .InternalID ,
51
+ Name : r .Name ,
52
+ AttachmentDisable : r .AttachmentDisable ,
53
+ TextDisable : r .TextDisable ,
54
+ BodyTemplate : r .BodyTemplate ,
55
+ Kind : r .Kind ,
56
+ Config : r .Config ,
53
57
}
54
58
55
59
_ , err := end .Parse ()
You can’t perform that action at this time.
0 commit comments