Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nodes-file-dir configuration #107

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cluster/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ func (a *Agent) raftPropose(msg *message.Message) {
}

func (a *Agent) getNodesFile() string {
if a.Config.NodesFileDir != "" {
return filepath.Join(a.Config.NodesFileDir, a.Config.NodeName+"-"+NodesFile)
}
return a.Config.NodeName + "-" + NodesFile
}

Expand Down
1 change: 1 addition & 0 deletions cmd/cluster/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func realMain(ctx context.Context) error {
flag.IntVar(&cfg.Redis.Options.DB, "redis-db", 0, "redis db for cluster mode")
flag.BoolVar(&cfg.Log.Enable, "log-enable", true, "log enabled or not")
flag.StringVar(&cfg.Log.Filename, "log-file", "./logs/comqtt.log", "log filename")
flag.StringVar(&cfg.Cluster.NodesFileDir, "nodes-file-dir", "", "directory holds nodes.json assisting node discovery for cluster")
//parse arguments
flag.Parse()
//load config file
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ type Cluster struct {
InboundPoolSize int `yaml:"inbound-pool-size" json:"inbound-pool-size"`
OutboundPoolSize int `yaml:"outbound-pool-size" json:"outbound-pool-size"`
InoutPoolNonblocking bool `yaml:"inout-pool-nonblocking" json:"inout-pool-nonblocking"`
NodesFileDir string `yaml:"nodes-file-dir" json:"nodes-file-dir"`
}

func GenTlsConfig(conf *Config) (*tls2.Config, error) {
Expand Down
Loading