fix minor issues in custom SD example (#4278)

Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
Callum Styan 2018-06-18 08:08:02 -07:00 committed by Brian Brazil
parent 6eab4bbca1
commit d0ee4da932
1 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ import (
var ( var (
a = kingpin.New("sd adapter usage", "Tool to generate file_sd target files for unimplemented SD mechanisms.") a = kingpin.New("sd adapter usage", "Tool to generate file_sd target files for unimplemented SD mechanisms.")
outputFile = a.Flag("output.file", "Output file for file_sd compatible file.").Default("custom_sd.json").String() outputFile = a.Flag("output.file", "Output file for file_sd compatible file.").Default("custom_sd.json").String()
listenAddress = a.Flag("listen.address", "The address the HTTP sd is listening on for requests.").Default("localhost:8080").String() listenAddress = a.Flag("listen.address", "The address the Consul HTTP API is listening on for requests.").Default("localhost:8500").String()
logger log.Logger logger log.Logger
// addressLabel is the name for the label containing a target's address. // addressLabel is the name for the label containing a target's address.
@ -196,7 +196,7 @@ func (d *discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
} }
tgs = append(tgs, tg) tgs = append(tgs, tg)
} }
if err != nil { if err == nil {
// We're returning all Consul services as a single targetgroup. // We're returning all Consul services as a single targetgroup.
ch <- tgs ch <- tgs
} }
@ -236,7 +236,7 @@ func main() {
// NOTE: create an instance of your new SD implementation here. // NOTE: create an instance of your new SD implementation here.
cfg := sdConfig{ cfg := sdConfig{
TagSeparator: ",", TagSeparator: ",",
Address: "localhost:8500", Address: *listenAddress,
RefreshInterval: 30, RefreshInterval: 30,
} }