7b0b9c7365
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.
26 lines
941 B
C#
26 lines
941 B
C#
using Microsoft.Extensions.Options;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Host;
|
|
|
|
/// <summary>
|
|
/// Binds <see cref="INodeIdentityProvider"/> to <see cref="NodeOptions.NodeName"/>.
|
|
/// Empty or whitespace values are normalised to <c>null</c>; otherwise the value
|
|
/// is returned trimmed.
|
|
/// </summary>
|
|
internal sealed class NodeIdentityProvider : INodeIdentityProvider
|
|
{
|
|
/// <inheritdoc />
|
|
public string? NodeName { get; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new <see cref="NodeIdentityProvider"/> from the given node options.
|
|
/// </summary>
|
|
/// <param name="nodeOptions">Node options whose <see cref="NodeOptions.NodeName"/> is normalised.</param>
|
|
public NodeIdentityProvider(IOptions<NodeOptions> nodeOptions)
|
|
{
|
|
var configured = nodeOptions.Value.NodeName;
|
|
NodeName = string.IsNullOrWhiteSpace(configured) ? null : configured.Trim();
|
|
}
|
|
}
|