96 lines
3.0 KiB
C#
96 lines
3.0 KiB
C#
namespace StellaOps.BinaryIndex.GroundTruth.SecDb.Configuration;
|
|
|
|
/// <summary>
|
|
/// Configuration options for the Alpine SecDB connector.
|
|
/// </summary>
|
|
public sealed class SecDbOptions
|
|
{
|
|
/// <summary>
|
|
/// HTTP client name for DI.
|
|
/// </summary>
|
|
public const string HttpClientName = "GroundTruth.SecDb";
|
|
|
|
/// <summary>
|
|
/// Git repository URL for Alpine secdb.
|
|
/// Default: https://gitlab.alpinelinux.org/alpine/secdb.git
|
|
/// </summary>
|
|
public string RepositoryUrl { get; set; } = "https://gitlab.alpinelinux.org/alpine/secdb.git";
|
|
|
|
/// <summary>
|
|
/// Local directory for secdb clone.
|
|
/// Default: null (uses temp directory)
|
|
/// </summary>
|
|
public string? LocalPath { get; set; }
|
|
|
|
/// <summary>
|
|
/// Git repository URL for Alpine aports (for patch details).
|
|
/// Default: https://gitlab.alpinelinux.org/alpine/aports.git
|
|
/// </summary>
|
|
public string AportsRepositoryUrl { get; set; } = "https://gitlab.alpinelinux.org/alpine/aports.git";
|
|
|
|
/// <summary>
|
|
/// Local directory for aports clone.
|
|
/// Default: null (uses temp directory)
|
|
/// </summary>
|
|
public string? AportsLocalPath { get; set; }
|
|
|
|
/// <summary>
|
|
/// Alpine branches to process.
|
|
/// Default: ["edge", "v3.19", "v3.18", "v3.17"]
|
|
/// </summary>
|
|
public List<string> Branches { get; set; } = ["edge", "v3.19", "v3.18", "v3.17"];
|
|
|
|
/// <summary>
|
|
/// Repositories within each branch to process.
|
|
/// Default: ["main", "community"]
|
|
/// </summary>
|
|
public List<string> Repositories { get; set; } = ["main", "community"];
|
|
|
|
/// <summary>
|
|
/// Whether to fetch aports for patch details.
|
|
/// Default: false (expensive operation)
|
|
/// </summary>
|
|
public bool FetchAports { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Request timeout in seconds for HTTP operations.
|
|
/// Default: 120 (git operations can be slow)
|
|
/// </summary>
|
|
public int TimeoutSeconds { get; set; } = 120;
|
|
|
|
/// <summary>
|
|
/// User-Agent header for HTTP requests.
|
|
/// </summary>
|
|
public string UserAgent { get; set; } = "StellaOps-GroundTruth/1.0 (secdb-connector)";
|
|
|
|
/// <summary>
|
|
/// Whether to use shallow clone to save bandwidth.
|
|
/// Default: true
|
|
/// </summary>
|
|
public bool ShallowClone { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Depth for shallow clone.
|
|
/// Default: 1
|
|
/// </summary>
|
|
public int CloneDepth { get; set; } = 1;
|
|
|
|
/// <summary>
|
|
/// Validate configuration.
|
|
/// </summary>
|
|
public void Validate()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(RepositoryUrl))
|
|
throw new InvalidOperationException("RepositoryUrl is required");
|
|
|
|
if (Branches is null || Branches.Count == 0)
|
|
throw new InvalidOperationException("At least one branch is required");
|
|
|
|
if (Repositories is null || Repositories.Count == 0)
|
|
throw new InvalidOperationException("At least one repository is required");
|
|
|
|
if (TimeoutSeconds <= 0)
|
|
throw new InvalidOperationException("TimeoutSeconds must be positive");
|
|
}
|
|
}
|