mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-04-10 14:59:04 +02:00
Configure MaxStreamSize
for ClamAV
This commit is contained in:
parent
156cec9828
commit
15df382a06
@ -51,6 +51,8 @@ namespace VoidCat.Model
|
||||
|
||||
public sealed record VirusScannerSettings
|
||||
{
|
||||
public Uri? ClamAV { get; init; }
|
||||
public ClamAVSettings? ClamAV { get; init; }
|
||||
}
|
||||
|
||||
public sealed record ClamAVSettings(Uri Endpoint, long? MaxStreamSize);
|
||||
}
|
||||
|
@ -9,17 +9,20 @@ public static class VirusScannerStartup
|
||||
public static void AddVirusScanner(this IServiceCollection services, VoidSettings settings)
|
||||
{
|
||||
services.AddTransient<IVirusScanStore, VirusScanStore>();
|
||||
|
||||
|
||||
var avSettings = settings.VirusScanner;
|
||||
if (avSettings != default)
|
||||
{
|
||||
services.AddHostedService<Background.VirusScannerService>();
|
||||
|
||||
|
||||
// load ClamAV scanner
|
||||
if (avSettings.ClamAV != default)
|
||||
{
|
||||
services.AddTransient<IClamClient>((_) =>
|
||||
new ClamClient(avSettings.ClamAV.Host, avSettings.ClamAV.Port));
|
||||
new ClamClient(avSettings.ClamAV.Endpoint.Host, avSettings.ClamAV.Endpoint.Port)
|
||||
{
|
||||
MaxStreamSize = avSettings.ClamAV.MaxStreamSize ?? 26240000
|
||||
});
|
||||
services.AddTransient<IVirusScanner, ClamAvScanner>();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user