mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Change option/parameter name
This commit is contained in:
4
main.go
4
main.go
@@ -50,7 +50,7 @@ Cluster Options:
|
||||
--routes <rurl-1, rurl-2> Routes to solicit and connect
|
||||
--cluster <cluster-url> Cluster URL for solicited routes
|
||||
--no_advertise <bool> Advertise known cluster IPs to clients
|
||||
--conn_retries <number> For implicit routes, number of connect retries
|
||||
--connect_retries <number> For implicit routes, number of connect retries
|
||||
|
||||
|
||||
Common Options:
|
||||
@@ -111,7 +111,7 @@ func main() {
|
||||
flag.StringVar(&opts.Cluster.ListenStr, "cluster", "", "Cluster url from which members can solicit routes.")
|
||||
flag.StringVar(&opts.Cluster.ListenStr, "cluster_listen", "", "Cluster url from which members can solicit routes.")
|
||||
flag.BoolVar(&opts.Cluster.NoAdvertise, "no_advertise", false, "Advertise known cluster IPs to clients.")
|
||||
flag.IntVar(&opts.Cluster.ConnRetries, "conn_retries", 0, "For implicit routes, number of connect retries")
|
||||
flag.IntVar(&opts.Cluster.ConnectRetries, "connect_retries", 0, "For implicit routes, number of connect retries")
|
||||
flag.BoolVar(&showTLSHelp, "help_tls", false, "TLS help.")
|
||||
flag.BoolVar(&opts.TLS, "tls", false, "Enable TLS.")
|
||||
flag.BoolVar(&opts.TLSVerify, "tlsverify", false, "Enable TLS with client verification.")
|
||||
|
||||
@@ -33,5 +33,5 @@ cluster {
|
||||
]
|
||||
|
||||
no_advertise: true
|
||||
conn_retries: 2
|
||||
connect_retries: 2
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@ type Permissions struct {
|
||||
|
||||
// Options for clusters.
|
||||
type ClusterOpts struct {
|
||||
Host string `json:"addr"`
|
||||
Port int `json:"cluster_port"`
|
||||
Username string `json:"-"`
|
||||
Password string `json:"-"`
|
||||
AuthTimeout float64 `json:"auth_timeout"`
|
||||
TLSTimeout float64 `json:"-"`
|
||||
TLSConfig *tls.Config `json:"-"`
|
||||
ListenStr string `json:"-"`
|
||||
NoAdvertise bool `json:"-"`
|
||||
ConnRetries int `json:"-"`
|
||||
Host string `json:"addr"`
|
||||
Port int `json:"cluster_port"`
|
||||
Username string `json:"-"`
|
||||
Password string `json:"-"`
|
||||
AuthTimeout float64 `json:"auth_timeout"`
|
||||
TLSTimeout float64 `json:"-"`
|
||||
TLSConfig *tls.Config `json:"-"`
|
||||
ListenStr string `json:"-"`
|
||||
NoAdvertise bool `json:"-"`
|
||||
ConnectRetries int `json:"-"`
|
||||
}
|
||||
|
||||
// Options block for gnatsd server.
|
||||
@@ -315,8 +315,8 @@ func parseCluster(cm map[string]interface{}, opts *Options) error {
|
||||
opts.Cluster.TLSTimeout = tc.Timeout
|
||||
case "no_advertise":
|
||||
opts.Cluster.NoAdvertise = mv.(bool)
|
||||
case "conn_retries":
|
||||
opts.Cluster.ConnRetries = int(mv.(int64))
|
||||
case "connect_retries":
|
||||
opts.Cluster.ConnectRetries = int(mv.(int64))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -650,8 +650,8 @@ func MergeOptions(fileOpts, flagOpts *Options) *Options {
|
||||
if flagOpts.Cluster.NoAdvertise {
|
||||
opts.Cluster.NoAdvertise = true
|
||||
}
|
||||
if flagOpts.Cluster.ConnRetries != 0 {
|
||||
opts.Cluster.ConnRetries = flagOpts.Cluster.ConnRetries
|
||||
if flagOpts.Cluster.ConnectRetries != 0 {
|
||||
opts.Cluster.ConnectRetries = flagOpts.Cluster.ConnectRetries
|
||||
}
|
||||
if flagOpts.RoutesStr != "" {
|
||||
mergeRoutes(&opts, flagOpts)
|
||||
|
||||
@@ -191,8 +191,8 @@ func TestMergeOverrides(t *testing.T) {
|
||||
PingInterval: 60 * time.Second,
|
||||
MaxPingsOut: 3,
|
||||
Cluster: ClusterOpts{
|
||||
NoAdvertise: true,
|
||||
ConnRetries: 2,
|
||||
NoAdvertise: true,
|
||||
ConnectRetries: 2,
|
||||
},
|
||||
}
|
||||
fopts, err := ProcessConfigFile("./configs/test.conf")
|
||||
@@ -208,8 +208,8 @@ func TestMergeOverrides(t *testing.T) {
|
||||
HTTPPort: DEFAULT_HTTP_PORT,
|
||||
ProfPort: 6789,
|
||||
Cluster: ClusterOpts{
|
||||
NoAdvertise: true,
|
||||
ConnRetries: 2,
|
||||
NoAdvertise: true,
|
||||
ConnectRetries: 2,
|
||||
},
|
||||
}
|
||||
merged := MergeOptions(fopts, opts)
|
||||
|
||||
@@ -696,11 +696,11 @@ func (s *Server) connectToRoute(rURL *url.URL, tryForEver bool) {
|
||||
if err != nil {
|
||||
Debugf("Error trying to connect to route: %v", err)
|
||||
if !tryForEver {
|
||||
if s.opts.Cluster.ConnRetries <= 0 {
|
||||
if s.opts.Cluster.ConnectRetries <= 0 {
|
||||
return
|
||||
}
|
||||
attempts++
|
||||
if attempts > s.opts.Cluster.ConnRetries {
|
||||
if attempts > s.opts.Cluster.ConnectRetries {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ func TestRouteConfig(t *testing.T) {
|
||||
Password: "bella",
|
||||
AuthTimeout: 1.0,
|
||||
Cluster: ClusterOpts{
|
||||
Host: "127.0.0.1",
|
||||
Port: 4244,
|
||||
Username: "route_user",
|
||||
Password: "top_secret",
|
||||
AuthTimeout: 1.0,
|
||||
NoAdvertise: true,
|
||||
ConnRetries: 2,
|
||||
Host: "127.0.0.1",
|
||||
Port: 4244,
|
||||
Username: "route_user",
|
||||
Password: "top_secret",
|
||||
AuthTimeout: 1.0,
|
||||
NoAdvertise: true,
|
||||
ConnectRetries: 2,
|
||||
},
|
||||
LogFile: "/tmp/nats_cluster_test.log",
|
||||
PidFile: "/tmp/nats_cluster_test.pid",
|
||||
|
||||
@@ -646,7 +646,7 @@ func TestImplicitRouteRetry(t *testing.T) {
|
||||
|
||||
optsA := nextServerOpts(optsSeed)
|
||||
optsA.Routes = server.RoutesFromStr(fmt.Sprintf("nats://%s:%d", optsSeed.Cluster.Host, optsSeed.Cluster.Port))
|
||||
optsA.Cluster.ConnRetries = 5
|
||||
optsA.Cluster.ConnectRetries = 5
|
||||
srvA := RunServer(optsA)
|
||||
defer srvA.Shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user