nuget reorganization
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Scanner.Surface.Env;
|
||||
using StellaOps.Scanner.Surface.FS;
|
||||
|
||||
namespace StellaOps.Scanner.WebService.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Aligns surface manifest store options with environment-derived cache settings.
|
||||
/// </summary>
|
||||
public sealed class SurfaceManifestStoreOptionsConfigurator : IConfigureOptions<SurfaceManifestStoreOptions>
|
||||
{
|
||||
private readonly ISurfaceEnvironment _surfaceEnvironment;
|
||||
private readonly IOptions<SurfaceCacheOptions> _cacheOptions;
|
||||
|
||||
public SurfaceManifestStoreOptionsConfigurator(
|
||||
ISurfaceEnvironment surfaceEnvironment,
|
||||
IOptions<SurfaceCacheOptions> cacheOptions)
|
||||
{
|
||||
_surfaceEnvironment = surfaceEnvironment ?? throw new ArgumentNullException(nameof(surfaceEnvironment));
|
||||
_cacheOptions = cacheOptions ?? throw new ArgumentNullException(nameof(cacheOptions));
|
||||
}
|
||||
|
||||
public void Configure(SurfaceManifestStoreOptions options)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
|
||||
var settings = _surfaceEnvironment.Settings;
|
||||
options.Bucket = settings.SurfaceFsBucket;
|
||||
options.Scheme = settings.SurfaceFsEndpoint.Scheme;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(options.RootDirectory))
|
||||
{
|
||||
options.RootDirectory = Path.Combine(
|
||||
_cacheOptions.Value.ResolveRoot(),
|
||||
"manifests");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user