8faaa8fe2b
New deployment-wide options bound from the "OpcUa" section of appsettings.json: - ApplicationName (default "ScadaLink-DCL") - TrustedIssuerStorePath / TrustedPeerStorePath / RejectedCertificateStorePath Empty paths fall back to Path.GetTempPath()/ScadaLink/pki/* so dev runs work without explicit config — same defaults the hardcoded values previously used. Wiring: - ServiceCollectionExtensions binds OpcUaGlobalOptions to the OpcUa section. - DataConnectionFactory takes IOptions<OpcUaGlobalOptions> and constructs RealOpcUaClientFactory with the snapshot. - RealOpcUaClient(globalOptions) replaces the hardcoded ApplicationName and the three CertificateTrustList store paths in ApplicationConfiguration. - Parameterless ctors on factory and client preserved for the existing test suite (32/32 DCL tests still green).
28 lines
957 B
C#
28 lines
957 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace ScadaLink.DataConnectionLayer;
|
|
|
|
public static class ServiceCollectionExtensions
|
|
{
|
|
public static IServiceCollection AddDataConnectionLayer(this IServiceCollection services)
|
|
{
|
|
services.AddOptions<DataConnectionOptions>()
|
|
.BindConfiguration("DataConnectionLayer");
|
|
|
|
services.AddOptions<OpcUaGlobalOptions>()
|
|
.BindConfiguration("OpcUa");
|
|
|
|
// WP-34: Register the factory for protocol extensibility
|
|
services.AddSingleton<IDataConnectionFactory, DataConnectionFactory>();
|
|
|
|
return services;
|
|
}
|
|
|
|
public static IServiceCollection AddDataConnectionLayerActors(this IServiceCollection services)
|
|
{
|
|
// Actor registration happens in AkkaHostedService or SiteCommunicationActor setup.
|
|
// DataConnectionManagerActor and DataConnectionActor instances are created by the actor system.
|
|
return services;
|
|
}
|
|
}
|