-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.yml
37 lines (37 loc) · 975 Bytes
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mqtt:
broker: localhost
port: 11883
clientId: mqtt-rewriter
username:
password:
delay:
enable: true
template:
enable: true
rules:
- topic: test
type: raw
targets:
- topic: test2
- topic: test2
type: json
targets:
- topic: test3
template: |-
Get value: {{.msg}}
Get nested value: {{.data.msg}}
Get value of an array by index: {{index .array 0}}
Get json of an object: {{json .data}}
Get json of an array: {{json .array}}
Range an array:
{{range $value := .array -}}
{{println $value}}
{{- end}}
Range an array with index:
{{range $index,$value := .array -}}
{{printf "%d:%s\n" $index $value}}
{{- end}}
Range an object:
{{range $key,$value := .data -}}
{{printf "%s:%s\n" $key $value}}
{{- end}}