feat: add MaxSubs, MaxSubTokens, Debug, Trace, LogFile, LogSizeLimit, Tags to NatsOptions

This commit is contained in:
Joseph Doherty
2026-02-23 00:32:12 -05:00
parent 5b383ada4b
commit 17a0a217dd
2 changed files with 30 additions and 0 deletions

View File

@@ -16,6 +16,19 @@ public sealed class NatsOptions
public TimeSpan PingInterval { get; set; } = TimeSpan.FromMinutes(2);
public int MaxPingsOut { get; set; } = 2;
// Subscription limits
public int MaxSubs { get; set; } // 0 = unlimited (per-connection)
public int MaxSubTokens { get; set; } // 0 = unlimited
// Logging / diagnostics
public bool Debug { get; set; }
public bool Trace { get; set; }
public string? LogFile { get; set; }
public long LogSizeLimit { get; set; }
// Server tags (exposed via /varz)
public Dictionary<string, string>? Tags { get; set; }
// Simple auth (single user)
public string? Username { get; set; }
public string? Password { get; set; }

View File

@@ -0,0 +1,17 @@
namespace NATS.Server.Tests;
public class NatsOptionsTests
{
[Fact]
public void Defaults_are_correct()
{
var opts = new NatsOptions();
opts.MaxSubs.ShouldBe(0);
opts.MaxSubTokens.ShouldBe(0);
opts.Debug.ShouldBe(false);
opts.Trace.ShouldBe(false);
opts.LogFile.ShouldBeNull();
opts.LogSizeLimit.ShouldBe(0L);
opts.Tags.ShouldBeNull();
}
}