chore: default bolt db location to .influxdbv2 dir
Per previous discussion in #1065.pull/10616/head
parent
dc73aee61f
commit
5af42835fa
|
@ -68,8 +68,8 @@ func influxDir() (string, error) {
|
|||
u, err := user.Current()
|
||||
if err == nil {
|
||||
dir = u.HomeDir
|
||||
} else if os.Getenv("HOME") != "" {
|
||||
dir = os.Getenv("HOME")
|
||||
} else if home := os.Getenv("HOME"); home != "" {
|
||||
dir = home
|
||||
} else {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
@ -83,6 +83,12 @@ func influxDir() (string, error) {
|
|||
}
|
||||
|
||||
func init() {
|
||||
dir, err := influxDir()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to determine influx directory: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
viper.SetEnvPrefix("INFLUX")
|
||||
|
||||
platformCmd.Flags().StringVar(&httpBindAddress, "http-bind-address", ":9999", "bind address for the rest http api")
|
||||
|
@ -97,7 +103,7 @@ func init() {
|
|||
authorizationPath = h
|
||||
}
|
||||
|
||||
platformCmd.Flags().StringVar(&boltPath, "bolt-path", "influxd.bolt", "path to boltdb database")
|
||||
platformCmd.Flags().StringVar(&boltPath, "bolt-path", filepath.Join(dir, "influxd.bolt"), "path to boltdb database")
|
||||
viper.BindEnv("BOLT_PATH")
|
||||
if h := viper.GetString("BOLT_PATH"); h != "" {
|
||||
boltPath = h
|
||||
|
@ -109,12 +115,6 @@ func init() {
|
|||
developerMode = h
|
||||
}
|
||||
|
||||
dir, err := influxDir()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to determine influx directory: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// TODO(edd): do we need NATS for anything?
|
||||
platformCmd.Flags().StringVar(&natsPath, "nats-path", filepath.Join(dir, "nats"), "path to persistent NATS files")
|
||||
viper.BindEnv("NATS_PATH")
|
||||
|
|
Loading…
Reference in New Issue