2018-05-15 18:27:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-06-18 17:48:52 +00:00
|
|
|
"context"
|
2019-12-30 19:53:52 +00:00
|
|
|
"fmt"
|
2018-05-15 18:27:32 +00:00
|
|
|
_ "net/http/pprof"
|
|
|
|
"os"
|
2019-12-31 00:56:58 +00:00
|
|
|
"time"
|
2018-05-15 18:27:32 +00:00
|
|
|
|
2020-01-08 16:16:13 +00:00
|
|
|
"github.com/influxdata/flux"
|
2020-04-03 17:39:20 +00:00
|
|
|
"github.com/influxdata/influxdb/v2"
|
|
|
|
"github.com/influxdata/influxdb/v2/cmd/influxd/launcher"
|
2020-08-26 17:46:47 +00:00
|
|
|
_ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1"
|
|
|
|
_ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1"
|
2019-03-13 23:06:50 +00:00
|
|
|
"github.com/spf13/cobra"
|
2018-05-15 18:27:32 +00:00
|
|
|
)
|
|
|
|
|
2019-01-18 13:38:58 +00:00
|
|
|
var (
|
|
|
|
version = "dev"
|
|
|
|
commit = "none"
|
2020-07-07 21:17:47 +00:00
|
|
|
date = ""
|
2019-01-18 13:38:58 +00:00
|
|
|
)
|
|
|
|
|
2020-06-18 17:48:52 +00:00
|
|
|
func main() {
|
2020-07-07 21:17:47 +00:00
|
|
|
if len(date) == 0 {
|
|
|
|
date = time.Now().UTC().Format(time.RFC3339)
|
|
|
|
}
|
|
|
|
|
2019-03-13 23:06:50 +00:00
|
|
|
influxdb.SetBuildInfo(version, commit, date)
|
2020-06-18 17:48:52 +00:00
|
|
|
|
|
|
|
rootCmd := launcher.NewInfluxdCommand(context.Background(),
|
2020-04-24 16:47:22 +00:00
|
|
|
// FIXME
|
|
|
|
//generate.Command,
|
|
|
|
//restore.Command,
|
2020-06-18 17:48:52 +00:00
|
|
|
&cobra.Command{
|
|
|
|
Use: "version",
|
|
|
|
Short: "Print the influxd server version",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
fmt.Printf("InfluxDB %s (git: %s) build_date: %s\n", version, commit, date)
|
|
|
|
},
|
2019-12-30 19:53:52 +00:00
|
|
|
},
|
2020-06-18 17:48:52 +00:00
|
|
|
)
|
2020-01-08 16:16:13 +00:00
|
|
|
|
|
|
|
// TODO: this should be removed in the future: https://github.com/influxdata/influxdb/issues/16220
|
|
|
|
if os.Getenv("QUERY_TRACING") == "1" {
|
|
|
|
flux.EnableExperimentalTracing()
|
|
|
|
}
|
2019-01-18 13:38:58 +00:00
|
|
|
|
2020-06-18 17:48:52 +00:00
|
|
|
if err := rootCmd.Execute(); err != nil {
|
2019-03-13 23:06:50 +00:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
2018-11-07 16:31:42 +00:00
|
|
|
}
|