Skip to content

Commit

Permalink
Add nodes-file-dir configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ohkinozomu committed Aug 3, 2024
1 parent 633231b commit 01b08e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
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

0 comments on commit 01b08e5

Please sign in to comment.