Commit 73d702c0 authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

plugin/metrcs: add env variable example (#1151)

We support ENV variables in config files, add an example in the one for
metric, note that `localhost:` is a valid host (in Go), so the
TestReadme will parse this correctly.

Fixes #1150
parent 4d6e9c38
...@@ -48,6 +48,15 @@ Use an alternative address: ...@@ -48,6 +48,15 @@ Use an alternative address:
} }
~~~ ~~~
Or via an enviroment variable (this is supported throughout the Corefile): `export PORT=9253`, and
then:
~~~ corefile
. {
prometheus localhost:{$PORT}
}
~~~
# Bugs # Bugs
When reloading, we keep the handler running, meaning that any changes to the handler's address When reloading, we keep the handler running, meaning that any changes to the handler's address
......
...@@ -14,15 +14,14 @@ import ( ...@@ -14,15 +14,14 @@ import (
"github.com/mholt/caddy" "github.com/mholt/caddy"
) )
// Pasrse all README.md's of the plugin and check if every example Corefile // TestReadme parses all README.md's of the plugins and checks if every example Corefile
// actually works. Each corefile is only used if the language is set to 'corefile': // actually works. Each corefile snippet is only used if the language is set to 'corefile':
// //
// ~~~ corefile // ~~~ corefile
// . { // . {
// # check-this-please // # check-this-please
// } // }
// ~~~ // ~~~
func TestReadme(t *testing.T) { func TestReadme(t *testing.T) {
port := 30053 port := 30053
caddy.Quiet = true caddy.Quiet = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment