Skip to content

Commit ed3ca38

Browse files
committed
Added docs for templates
1 parent e1194cd commit ed3ca38

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ Flag | Env Variable | Default | Description
4444
`--debug` | `SNS_FORWARDER_DEBUG` | `false` | Debug mode
4545
`--arn-prefix` | `SNS_FORWARDER_ARN_PREFIX` | not specified | Prefix to use for SNS topic ARNs. If not specified, will try to be detected automatically.
4646

47+
## Customising messages with template
48+
49+
The app also supports [go templating language](https://golang.org/pkg/text/template/).
50+
The feature was ported from [prometheus_bot](https://github.com/inCaller/prometheus_bot) and you can read more about this functionality in their [docs](https://github.com/inCaller/prometheus_bot#customising-messages-with-template).
51+
52+
The settings for using templates are available as the following flags or env vars.
53+
54+
Flag | Env Variable | Default | Description
55+
-----------------------------|------------------------------------------|---------------|------------
56+
`--template-path` | `SNS_FORWARDER_TEMPLATE_PATH` | | Template path
57+
`--template-time-zone` | `SNS_FORWARDER_TEMPLATE_TIME_ZONE` | | Template time zone
58+
`--template-time-out-format` | `SNS_FORWARDER_TEMPLATE_TIME_OUT_FORMAT` | | Template time out format
59+
`--template-split-token` | `SNS_FORWARDER_TEMPLATE_SPLIT_TOKEN` | | Token used for split measure label
60+
61+
There are also an [example template file](testdata/default.tmpl) along with an [example payload json](testdata/simple.json) provided.
62+
4763
### Endpoints
4864

4965
The app exposes the following HTTP endpoints:

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func main() {
153153

154154
log.Info("listening on", *listen_addr)
155155

156-
router.Run(*listen_addr)
156+
router.Run(*listen_addr)
157157
}
158158

159159
func registerCustomPrometheusMetrics() {

0 commit comments

Comments
 (0)