commit
b42f614e57
|
@ -6,6 +6,7 @@
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- [#1971](https://github.com/influxdb/influxdb/pull/1971): Fix leader id initialization.
|
- [#1971](https://github.com/influxdb/influxdb/pull/1971): Fix leader id initialization.
|
||||||
- [#1975](https://github.com/influxdb/influxdb/pull/1975): Require `q` parameter for query endpoint.
|
- [#1975](https://github.com/influxdb/influxdb/pull/1975): Require `q` parameter for query endpoint.
|
||||||
|
- [#1969](https://github.com/influxdb/influxdb/pull/1969): Print loaded config.
|
||||||
|
|
||||||
## v0.9.0-rc12 [2015-03-15]
|
## v0.9.0-rc12 [2015-03-15]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -259,6 +260,11 @@ func (c *Config) ShardGroupPreCreateCheckPeriod() time.Duration {
|
||||||
return DefaultRetentionCreatePeriod
|
return DefaultRetentionCreatePeriod
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WriteConfigFile writes the config to the specified writer
|
||||||
|
func (c *Config) Write(w io.Writer) error {
|
||||||
|
return toml.NewEncoder(w).Encode(c)
|
||||||
|
}
|
||||||
|
|
||||||
// Size represents a TOML parseable file size.
|
// Size represents a TOML parseable file size.
|
||||||
// Users can specify size using "m" for megabytes and "g" for gigabytes.
|
// Users can specify size using "m" for megabytes and "g" for gigabytes.
|
||||||
type Size int
|
type Size int
|
||||||
|
|
|
@ -70,6 +70,8 @@ func main() {
|
||||||
execRun(args)
|
execRun(args)
|
||||||
case "version":
|
case "version":
|
||||||
execVersion(args[1:])
|
execVersion(args[1:])
|
||||||
|
case "config":
|
||||||
|
execConfig(args[1:])
|
||||||
case "help":
|
case "help":
|
||||||
execHelp(args[1:])
|
execHelp(args[1:])
|
||||||
default:
|
default:
|
||||||
|
@ -102,6 +104,9 @@ func execRun(args []string) {
|
||||||
log.SetFlags(log.LstdFlags)
|
log.SetFlags(log.LstdFlags)
|
||||||
writePIDFile(*pidPath)
|
writePIDFile(*pidPath)
|
||||||
|
|
||||||
|
if configPath != nil {
|
||||||
|
log.Println("No config provided, using default settings")
|
||||||
|
}
|
||||||
config := parseConfig(*configPath, *hostname)
|
config := parseConfig(*configPath, *hostname)
|
||||||
|
|
||||||
// Create a logging writer.
|
// Create a logging writer.
|
||||||
|
@ -140,6 +145,21 @@ func execVersion(args []string) {
|
||||||
log.Print(s)
|
log.Print(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// execConfig parses and prints the current config loaded.
|
||||||
|
func execConfig(args []string) {
|
||||||
|
// Parse command flags.
|
||||||
|
fs := flag.NewFlagSet("", flag.ExitOnError)
|
||||||
|
var (
|
||||||
|
configPath = fs.String("config", "", "")
|
||||||
|
hostname = fs.String("hostname", "", "")
|
||||||
|
)
|
||||||
|
fs.Parse(args)
|
||||||
|
|
||||||
|
config := parseConfig(*configPath, *hostname)
|
||||||
|
|
||||||
|
config.Write(os.Stdout)
|
||||||
|
}
|
||||||
|
|
||||||
// execHelp runs the "help" command.
|
// execHelp runs the "help" command.
|
||||||
func execHelp(args []string) {
|
func execHelp(args []string) {
|
||||||
fmt.Println(`
|
fmt.Println(`
|
||||||
|
|
|
@ -236,7 +236,6 @@ func writePIDFile(path string) {
|
||||||
// parses the configuration from a given path. Sets overrides as needed.
|
// parses the configuration from a given path. Sets overrides as needed.
|
||||||
func parseConfig(path, hostname string) *Config {
|
func parseConfig(path, hostname string) *Config {
|
||||||
if path == "" {
|
if path == "" {
|
||||||
log.Println("No config provided, using default settings")
|
|
||||||
return NewConfig()
|
return NewConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue