Skip to content

Commit

Permalink
Enabling embedded NATS leaf nodes
Browse files Browse the repository at this point in the history
 - Setting sequence CBOR path to same as DB path if not specificed
 - Setting config file to be empty by default
 - Enabling Leaf node on port + 1 of cluster port
  • Loading branch information
maxpert committed Jul 16, 2023
1 parent 09e2e8f commit b7fafc2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ type Configuration struct {
Logging LoggingConfiguration `toml:"logging"`
}

var ConfigPathFlag = flag.String("config", "marmot.toml", "Path to configuration file")
var ConfigPathFlag = flag.String("config", "", "Path to configuration file")
var CleanupFlag = flag.Bool("cleanup", false, "Only cleanup marmot triggers and changelogs")
var SaveSnapshotFlag = flag.Bool("save-snapshot", false, "Only take snapshot and upload")
var ClusterAddrFlag = flag.String("cluster-addr", "", "Cluster listening address")
var ClusterPeersFlag = flag.String("cluster-peers", "", "Comma separated list of clusters")

var DataRootDir = os.TempDir()
var Config = &Configuration{
SeqMapPath: "",
SeqMapPath: path.Join(DataRootDir, "seq-map.cbor"),
DBPath: path.Join(DataRootDir, "marmot.db"),
NodeID: 0,
Publish: true,
Expand Down
4 changes: 4 additions & 0 deletions stream/embedded_nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func startEmbeddedServer(nodeName string) (*embeddedNats, error) {
opts.Cluster.ListenStr = *cfg.ClusterAddrFlag
opts.Cluster.Host = host
opts.Cluster.Port = port
opts.LeafNode = server.LeafNodeOpts{
Host: host,
Port: port + 1,
}
}

if cfg.Config.NATS.ServerConfigFile != "" {
Expand Down

0 comments on commit b7fafc2

Please sign in to comment.