Skip to content

Commit 9094bed

Browse files
docs: update rule expression docs
1 parent 43a2bdf commit 9094bed

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ rules:
237237
238238
See [`text/template`](https://pkg.go.dev/text/template) on how to template.
239239

240-
Each `*_template` config variable has access to the [Envelope](./internal/models/envelope.go) model via the `.` operator.
240+
Each `*_template` has access to the [Envelope](./internal/models/envelope.go) model via the `.` operator.
241241

242242
The following custom functions are available in endpoint templates.
243243

@@ -247,9 +247,25 @@ The following custom functions are available in endpoint templates.
247247

248248
## Expressions
249249

250-
Rule expressions are just [templates](#templates) without `{{ }}` and custom functions.
250+
Rule expressions are just [`text/template`](https://pkg.go.dev/text/template) without `{{ }}`.
251+
The [Envelope](./internal/models/envelope.go) model can be accessed via the `.` operator.
251252
They should always evaluate to a boolean expression.
252253

254+
Example:
255+
256+
```
257+
or
258+
(eq .Message.Subject "cam-1")
259+
(.Message.To.EQ "my-name@example.com")
260+
(eq .Message.From "unleashed@example.com")
261+
```
262+
263+
This expression will pass if one of the following is true.
264+
265+
- The message's subject equals "cam-1"
266+
- The message is to "<my-name@example.com>"
267+
- The message is from "<unleashed@example.com>"
268+
253269
# Docker
254270

255271
## Docker Compose
@@ -330,6 +346,7 @@ make dev-web
330346

331347
# To Do
332348

349+
- refactor: WAY TOO MANY TOOLS TO BUILD THE PROGRAM, REMOVE SOME
333350
- feat: read [mbox](https://access.redhat.com/articles/6167512) files
334351
- feat: IMAP for viewing mail
335352
- feat: OpenAPI

0 commit comments

Comments
 (0)