Skip to content

Commit 8b9b375

Browse files
committed
feat: validate StorageType in NatsStreamOptionsValidator
Reject StorageType values that are not defined StreamConfigStorage enum members before they reach JetStream, throwing OrleansConfigurationException with the valid values (File/Memory). Addresses review feedback on #10028.
1 parent 6d5cc57 commit 8b9b375

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/Orleans.Streaming.NATS/NatsOptions.cs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,12 @@ public void ValidateConfiguration()
9191
throw new OrleansConfigurationException(
9292
$"The {nameof(NatsOptions.NumReplicas)} must be at least 1 for the NATS stream provider '{name}'.");
9393
}
94+
95+
if (!Enum.IsDefined(typeof(StreamConfigStorage), options.StorageType))
96+
{
97+
throw new OrleansConfigurationException(
98+
$"The {nameof(NatsOptions.StorageType)} value '{options.StorageType}' is not valid for the NATS stream provider '{name}'. " +
99+
$"Valid values are {nameof(StreamConfigStorage.File)} and {nameof(StreamConfigStorage.Memory)}.");
100+
}
94101
}
95102
}

0 commit comments

Comments
 (0)