commit
b42f614e57
|
@ -6,6 +6,7 @@
|
|||
### Bugfixes
|
||||
- [#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.
|
||||
- [#1969](https://github.com/influxdb/influxdb/pull/1969): Print loaded config.
|
||||
|
||||
## v0.9.0-rc12 [2015-03-15]
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"net/url"
|
||||
|
@ -259,6 +260,11 @@ func (c *Config) ShardGroupPreCreateCheckPeriod() time.Duration {
|
|||
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.
|
||||
// Users can specify size using "m" for megabytes and "g" for gigabytes.
|
||||
type Size int
|
||||
|
|
|
@ -70,6 +70,8 @@ func main() {
|
|||
execRun(args)
|
||||
case "version":
|
||||
execVersion(args[1:])
|
||||
case "config":
|
||||
execConfig(args[1:])
|
||||
case "help":
|
||||
execHelp(args[1:])
|
||||
default:
|
||||
|
@ -102,6 +104,9 @@ func execRun(args []string) {
|
|||
log.SetFlags(log.LstdFlags)
|
||||
writePIDFile(*pidPath)
|
||||
|
||||
if configPath != nil {
|
||||
log.Println("No config provided, using default settings")
|
||||
}
|
||||
config := parseConfig(*configPath, *hostname)
|
||||
|
||||
// Create a logging writer.
|
||||
|
@ -140,6 +145,21 @@ func execVersion(args []string) {
|
|||
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.
|
||||
func execHelp(args []string) {
|
||||
fmt.Println(`
|
||||
|
|
|
@ -236,7 +236,6 @@ func writePIDFile(path string) {
|
|||
// parses the configuration from a given path. Sets overrides as needed.
|
||||
func parseConfig(path, hostname string) *Config {
|
||||
if path == "" {
|
||||
log.Println("No config provided, using default settings")
|
||||
return NewConfig()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue