add some more jetstream options

Signed-off-by: R.I.Pienaar <rip@devco.net>
This commit is contained in:
R.I.Pienaar
2020-01-31 11:19:08 +01:00
committed by Derek Collison
parent ef77156890
commit da5425b3da
2 changed files with 16 additions and 6 deletions

View File

@@ -185,7 +185,9 @@ type Options struct {
Gateway GatewayOpts `json:"gateway,omitempty"`
LeafNode LeafNodeOpts `json:"leaf,omitempty"`
JetStream bool `json:"jetstream"`
StoreDir string `json:"store_dir"`
JetStreamMaxMemory int64 `json:"-"`
JetStreamMaxStore int64 `json:"-"`
StoreDir string `json:"-"`
ProfPort int `json:"-"`
PidFile string `json:"-"`
PortsFileDir string `json:"-"`
@@ -1145,6 +1147,10 @@ func parseJetStream(v interface{}, opts *Options, errors *[]error, warnings *[]e
switch strings.ToLower(mk) {
case "store_dir", "storedir":
opts.StoreDir = mv.(string)
case "max_memory_store", "max_mem_store":
opts.JetStreamMaxMemory = mv.(int64)
case "max_file_store":
opts.JetStreamMaxStore = mv.(int64)
default:
if !tk.IsUsedVariable() {
err := &unknownConfigFieldErr{

View File

@@ -24,6 +24,8 @@ import (
"math/rand"
"net"
"net/http"
// Allow dynamic profiling.
_ "net/http/pprof"
"os"
"path"
"path/filepath"
@@ -34,12 +36,10 @@ import (
"sync/atomic"
"time"
// Allow dynamic profiling.
_ "net/http/pprof"
"github.com/nats-io/jwt"
"github.com/nats-io/nats-server/v2/logger"
"github.com/nats-io/nkeys"
"github.com/nats-io/nats-server/v2/logger"
)
const (
@@ -1260,7 +1260,11 @@ func (s *Server) Start() {
if opts.JetStream {
var cfg *JetStreamConfig
if opts.StoreDir != "" {
cfg = &JetStreamConfig{StoreDir: opts.StoreDir}
cfg = &JetStreamConfig{
StoreDir: opts.StoreDir,
MaxMemory: opts.JetStreamMaxMemory,
MaxStore: opts.JetStreamMaxStore,
}
}
if err := s.EnableJetStream(cfg); err != nil {
s.Fatalf("Can't start jetstream: %v", err)