feat(site): DeployedSecretsMirror — per-node apply + decrypt-verify of deployed secrets
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ZB.MOM.WW.LocalDb;
|
||||
@@ -9,6 +10,7 @@ using ZB.MOM.WW.ScadaBridge.SiteRuntime.Deployment;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Persistence;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Repositories;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Scripts;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Secrets;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime.Streaming;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime;
|
||||
@@ -123,6 +125,21 @@ public static class ServiceCollectionExtensions
|
||||
sp.GetRequiredService<IOptionsMonitor<SiteRuntimeOptions>>(),
|
||||
sp.GetRequiredService<ILogger<ScriptRunSummaryFlushService>>()));
|
||||
|
||||
// Site-secrets artifact deploy (Task 9): per-node reconcile of the site-wide,
|
||||
// LocalDb-replicated deployed_secrets table into THIS node's own ZB.MOM.WW.Secrets
|
||||
// store. Runs on every site node — not a singleton, since mirrored_secrets (which
|
||||
// names this node has already applied) is deliberately node-local, not replicated.
|
||||
// Registered as a singleton (not just a hosted service) so ReconcileAsync can also
|
||||
// be invoked synchronously — by tests, and by any future on-demand trigger (e.g.
|
||||
// right after an artifact deploy lands secrets) — without waiting for the next tick.
|
||||
// ISecretStore/ISecretResolver are registered by the Host's AddScadaBridgeSecrets
|
||||
// (SecretsNodeRole.Site) — DI registration order does not matter, only that both
|
||||
// calls happen before the provider is built, which SiteServiceRegistration.Configure
|
||||
// guarantees.
|
||||
services.TryAddSingleton(TimeProvider.System);
|
||||
services.AddSingleton<DeployedSecretsMirror>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<DeployedSecretsMirror>());
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user