mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-03-25 17:41:57 -04:00
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Cleanuparr.Domain.Enums;
|
|
using Cleanuparr.Shared.Helpers;
|
|
using ValidationException = Cleanuparr.Domain.Exceptions.ValidationException;
|
|
|
|
namespace Cleanuparr.Persistence.Models.Configuration.General;
|
|
|
|
public sealed record GeneralConfig : IConfig
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
|
|
public bool DisplaySupportBanner { get; set; } = true;
|
|
|
|
public bool DryRun { get; set; }
|
|
|
|
public ushort HttpMaxRetries { get; set; }
|
|
|
|
public ushort HttpTimeout { get; set; } = 100;
|
|
|
|
public CertificateValidationType HttpCertificateValidation { get; set; } = CertificateValidationType.Enabled;
|
|
|
|
|
|
public bool StatusCheckEnabled { get; set; } = true;
|
|
|
|
public string EncryptionKey { get; set; } = Guid.NewGuid().ToString();
|
|
|
|
public List<string> IgnoredDownloads { get; set; } = [];
|
|
|
|
public ushort StrikeInactivityWindowHours { get; set; } = 24;
|
|
|
|
public LoggingConfig Log { get; set; } = new();
|
|
|
|
public AuthConfig Auth { get; set; } = new();
|
|
|
|
public void Validate()
|
|
{
|
|
if (HttpTimeout is 0)
|
|
{
|
|
throw new ValidationException($"{nameof(HttpTimeout)} must be greater than 0");
|
|
}
|
|
|
|
Log.Validate();
|
|
Auth.Validate();
|
|
}
|
|
} |