diff --git a/cmd/chronograf/main.go b/cmd/chronograf/main.go index f5731616d4..6222dedeff 100644 --- a/cmd/chronograf/main.go +++ b/cmd/chronograf/main.go @@ -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) diff --git a/server/server.go b/server/server.go index a54ea0d167..a9a5627ca3 100644 --- a/server/server.go +++ b/server/server.go @@ -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"`