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