diff --git a/cmd/influxd/config.go b/cmd/influxd/config.go index 129318247d..52e4fc720b 100644 --- a/cmd/influxd/config.go +++ b/cmd/influxd/config.go @@ -33,6 +33,9 @@ const ( // DefaultAPIReadTimeout represents the duration before an API request times out. DefaultAPIReadTimeout = 5 * time.Second + // DefaultClusterPort represents the default port the cluster runs ons. + DefaultClusterPort = 8086 + // DefaultBrokerPort represents the default port the broker runs on. DefaultBrokerPort = 8086 @@ -128,6 +131,7 @@ type Data struct { type Config struct { Hostname string `toml:"hostname"` BindAddress string `toml:"bind-address"` + Port int `toml:"port"` ReportingDisabled bool `toml:"reporting-disabled"` Version string `toml:"-"` InfluxDBVersion string `toml:"-"` @@ -214,8 +218,8 @@ type Config struct { // NewConfig returns an instance of Config with reasonable defaults. func NewConfig() *Config { c := &Config{} + c.Port = DefaultClusterPort c.Broker.Port = DefaultBrokerPort - c.Data.Port = DefaultDataPort c.Data.RetentionAutoCreate = DefaultRetentionAutoCreate diff --git a/cmd/influxd/config_test.go b/cmd/influxd/config_test.go index 8d4d82214b..e64830f264 100644 --- a/cmd/influxd/config_test.go +++ b/cmd/influxd/config_test.go @@ -19,6 +19,7 @@ const testFile = ` # systems in the cluster, you'll have to set the hostname to an IP or something # that can be resolved here. hostname = "myserver.com" +port = 8086 # Controls certain parameters that only take effect until an initial successful # start-up has occurred. @@ -152,6 +153,10 @@ func TestParseConfig(t *testing.T) { t.Fatalf("hostname mismatch: %v", c.Hostname) } + if exp := 8086; c.Port != exp { + t.Fatalf("port mismatch. got %v, exp %v", c.Port, exp) + } + if c.JoinURLs() != "http://127.0.0.1:8086" { t.Fatalf("JoinURLs mistmatch: %v", c.JoinURLs()) }