refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.NotificationService;
|
||||
|
||||
/// <summary>
|
||||
/// NS-005: The three TLS modes the design doc defines for SMTP connections.
|
||||
/// A single boolean cannot represent the requirement, so the configured
|
||||
/// <c>SmtpConfiguration.TlsMode</c> string is parsed into this three-state enum.
|
||||
/// </summary>
|
||||
public enum SmtpTlsMode
|
||||
{
|
||||
/// <summary>No transport security — plain SMTP. Maps to <c>SecureSocketOptions.None</c>.</summary>
|
||||
None,
|
||||
|
||||
/// <summary>Opportunistic STARTTLS upgrade (typically port 587). Maps to <c>SecureSocketOptions.StartTls</c>.</summary>
|
||||
StartTls,
|
||||
|
||||
/// <summary>Implicit TLS / SSL-on-connect (typically port 465). Maps to <c>SecureSocketOptions.SslOnConnect</c>.</summary>
|
||||
Ssl,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NS-005: Parses the free-text <c>SmtpConfiguration.TlsMode</c> value into a
|
||||
/// <see cref="SmtpTlsMode"/>, rejecting unknown values rather than silently
|
||||
/// falling back to opportunistic negotiation.
|
||||
/// </summary>
|
||||
public static class SmtpTlsModeParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses a configured TLS mode string. A null or empty value defaults to
|
||||
/// <see cref="SmtpTlsMode.StartTls"/> (the design-doc default for port 587).
|
||||
/// </summary>
|
||||
/// <param name="tlsMode">The TLS mode string to parse (None, StartTLS, or SSL); null/empty defaults to StartTLS.</param>
|
||||
/// <exception cref="ArgumentException">The value is not one of None/StartTLS/SSL.</exception>
|
||||
public static SmtpTlsMode Parse(string? tlsMode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tlsMode))
|
||||
{
|
||||
return SmtpTlsMode.StartTls;
|
||||
}
|
||||
|
||||
return tlsMode.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"none" => SmtpTlsMode.None,
|
||||
"starttls" => SmtpTlsMode.StartTls,
|
||||
"ssl" => SmtpTlsMode.Ssl,
|
||||
_ => throw new ArgumentException(
|
||||
$"Unknown SMTP TLS mode '{tlsMode}'. Expected one of: None, StartTLS, SSL.",
|
||||
nameof(tlsMode)),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user