From 340ed6f40e83e933fe45c63f5f9b68654eccc5ad Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Thu, 6 Jul 2017 11:57:02 -0700 Subject: [PATCH] Move throwaway parsing type into NewSources --- chronograf.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/chronograf.go b/chronograf.go index bb81cc8f62..58bf31bd1e 100644 --- a/chronograf.go +++ b/chronograf.go @@ -626,17 +626,16 @@ type LayoutStore interface { Update(context.Context, Layout) error } -// SourceAndKapacitor allows a --new-source to be parsed into a source and a kapacitor -type SourceAndKapacitor struct { - Source Source `json:"influxdb"` - Kapacitor Server `json:"kapacitor"` -} - // NewSources adds sources and respective kapacitors to BoltDb idempotently by name func NewSources(ctx context.Context, sourcesStore SourcesStore, serversStore ServersStore, newSources string, logger Logger) error { // Once a bolt connection is created, try to add any new sources with respective kapacitor servers if newSources != "" { + type SourceAndKapacitor struct { + Source Source `json:"influxdb"` + Kapacitor Server `json:"kapacitor"` + } var srcsKaps []SourceAndKapacitor + // On JSON unmarshal error, continue server process without new source and write error to log if err := json.Unmarshal([]byte(newSources), &srcsKaps); err != nil { logger.