feat(storage): stockage configurable par l'IHM — providers Fichier + S3 (Fixes #78)

- IStorageProvider (Application) : Upload/Download/Delete/DeleteBatch/Health
- LocalStorageProvider : écriture atomique (tmp + move), anti path-traversal
- AlarikStorageProvider : S3-compatible (AWS SDK, ForcePathStyle), upload
  staging→final (atomique), batch delete 1000/appel (Correctif D6)
- StorageProviderFactory : provider résolu depuis les settings DB
  (storage.provider = Local|S3) avec fallback env, re-résolu à chaque appel
- Seed idempotent des clés storage.* (catégorie 'storage') au démarrage
- UI : section 'Stockage' dédiée dans SettingsPage (sélecteur Local/S3,
  champs conditionnels, clé secrète masquée, bouton Tester → POST
  /api/settings/storage/test)
- Tests : 6 LocalStorageProvider (roundtrip, delete, batch, traversal,
  health) ; Web 217/217, Infrastructure 177/177, Application 391/391
This commit is contained in:
Arnaud Dartois committed 2026-08-12 10:14:40 +02:00
1 parent 2e188e4dda
commit 7d6213696f
11 files changed
+685 -1

No files matched your search

@@ -228,6 +228,27 @@ public class SettingsController : ControllerBase
return NoContent();
}
/// <summary>
/// Test the active storage provider reachability (Admin only).
/// Returns the resolved provider name and health status.
/// </summary>
[Authorize(AuthenticationSchemes = "JwtBearer,Cookies", Policy = AppPermissions.AdminManage)]
[HttpPost("storage/test")]
[ProducesResponseType(typeof(object), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
public async Task<IActionResult> TestStorage(
[FromServices] IStorageProvider storageProvider,
CancellationToken ct)
{
var ok = await storageProvider.HealthCheckAsync(ct);
return Ok(new
{
provider = storageProvider.Provider,
configured = storageProvider.IsConfigured,
healthy = ok,
});
}
/// <summary>
/// Broadcast a "ConfigReload" signal to all connected agents so they
/// re-fetch their full configuration (Admin only).