Add pseudocode outline for parsing and persisting source and server

Signed-off-by: Tim Raymond <tim@timraymond.com>
pull/10616/head
Jared Scheib 2017-06-29 15:33:22 -07:00 committed by Tim Raymond
parent 639bce7217
commit 0c8b543806
2 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,25 @@ func main() {
os.Exit(0)
}
if srv.NewSource != "" {
/*
// parse influxdb key from newsource into chronograf.Source struct from chronograf.go
// parse kapacitor key from newsource into chronograf.Server struct from chronograf.go
// open connection to boltDB
// use sources.All to get all sources
// if that influxdb does not exist (how to compare?)
// use sourcesStore to add this new source
// if successful
// hold onto this new source id
// if that kapacitor does not exist (how to compare?)
// use serverStore to add new kapacitor, including new source id
// else
// throw error
// else
// do nothing
*/
}
ctx := context.Background()
if err := srv.Serve(ctx); err != nil {
log.Fatalln(err)

View File

@ -50,6 +50,8 @@ type Server struct {
KapacitorUsername string `long:"kapacitor-username" description:"Username of your Kapacitor instance" env:"KAPACITOR_USERNAME"`
KapacitorPassword string `long:"kapacitor-password" description:"Password of your Kapacitor instance" env:"KAPACITOR_PASSWORD"`
NewSource map[string]string `long:"new-source" description:"Config for adding a new InfluxDb source and Kapacitor server" env:"NEW_SOURCE"`
Develop bool `short:"d" long:"develop" description:"Run server in develop mode."`
BoltPath string `short:"b" long:"bolt-path" description:"Full path to boltDB file (/var/lib/chronograf/chronograf-v1.db)" env:"BOLT_PATH" default:"chronograf-v1.db"`
CannedPath string `short:"c" long:"canned-path" description:"Path to directory of pre-canned application layouts (/usr/share/chronograf/canned)" env:"CANNED_PATH" default:"canned"`