feat(auditlog): scaffold ScadaLink.AuditLog project + tests project (#23)

This commit is contained in:
Joseph Doherty
2026-05-20 11:14:03 -04:00
parent de839627ed
commit a15ceb3ec9
6 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using ScadaLink.AuditLog.Configuration;
namespace ScadaLink.AuditLog;
/// <summary>
/// Composition root for the Audit Log (#23) component. M1 registers
/// <see cref="AuditLogOptions"/>; later milestones extend this method to wire
/// up writers, telemetry actors, and the central ingest pipeline. Audit Log
/// (#23) sits alongside Notification Outbox (#21) and Site Call Audit (#22).
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>Configuration section bound to <see cref="AuditLogOptions"/>.</summary>
public const string ConfigSectionName = "AuditLog";
/// <summary>
/// Binds <see cref="AuditLogOptions"/> from the
/// <see cref="ConfigSectionName"/> section of <paramref name="config"/>.
/// M2+ will register writers, telemetry actors, and the central ingest
/// pipeline here. <c>IAuditLogRepository</c> is registered by
/// <c>ScadaLink.ConfigurationDatabase.ServiceCollectionExtensions.AddConfigurationDatabase</c>,
/// so the caller (the Host on the central node) must also call that.
/// </summary>
public static IServiceCollection AddAuditLog(this IServiceCollection services, IConfiguration config)
{
ArgumentNullException.ThrowIfNull(services);
ArgumentNullException.ThrowIfNull(config);
services.AddOptions<AuditLogOptions>()
.Bind(config.GetSection(ConfigSectionName));
return services;
}
}