File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,7 @@ protected NatsServerRunner(Builder b) throws IOException {
376376 }
377377
378378 if (b .configInserts != null ) {
379+ boolean processJetstream = true ;// the case where the inserts have a jetstream block and a jsEnabled
379380 List <String > jsInserts = new ArrayList <>();
380381 boolean inJsInserts = false ;
381382 for (String s : b .configInserts ) {
@@ -387,19 +388,29 @@ protected NatsServerRunner(Builder b) throws IOException {
387388 jsInserts .add (trim );
388389 if (trim .endsWith ("}" )) {
389390 inJsInserts = false ;
391+ processJetstream = false ;
390392 _jsConfig .set (new JsConfig (jsInserts ));
391393 }
392394 }
393- else if (trim .startsWith ("jetstream" )) {
395+ else if (trim .startsWith ("jetstream" ) && processJetstream ) {
394396 if (_jsConfig .get () != null ) {
395397 throw new IOException ("jetstream block provided in both config inserts and config file" );
396398 }
397399 if (trim .endsWith ("enabled" )) {
398400 _jsConfig .set (new JsConfig ());
401+ processJetstream = false ;
399402 }
400403 else {
401- inJsInserts = true ;
402404 jsInserts .add (trim );
405+ if (trim .endsWith ("}" )) {
406+ // a one-liner...
407+ _jsConfig .set (new JsConfig (jsInserts ));
408+ processJetstream = false ;
409+ }
410+ else {
411+ inJsInserts = true ;
412+ }
413+
403414 }
404415 }
405416 else {
You can’t perform that action at this time.
0 commit comments