Add Cluster port

This is the port that all cluster communication will take place
over.  It will replace the separate data and broker ports.
pull/2175/head
Jason Wilder 2015-04-02 15:28:01 -06:00
parent 73f6f8cb44
commit 23819d10d2
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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())
}