feat: add MaxSubs, MaxSubTokens, Debug, Trace, LogFile, LogSizeLimit, Tags to NatsOptions
This commit is contained in:
@@ -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; }
|
||||
|
||||
17
tests/NATS.Server.Tests/NatsOptionsTests.cs
Normal file
17
tests/NATS.Server.Tests/NatsOptionsTests.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user