mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-25 14:01:13 +00:00
finished refactoring and README.md rewrite
This commit is contained in:
@@ -5,11 +5,13 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Consul;
|
||||
using MalwareMultiScan.Backends.Backends.Interfaces;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace MalwareMultiScan.Scanner.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Consul registration hosted service.
|
||||
/// </summary>
|
||||
public class ConsulHostedService : BackgroundService
|
||||
{
|
||||
private static readonly string ServiceId = Dns.GetHostName();
|
||||
@@ -18,9 +20,13 @@ namespace MalwareMultiScan.Scanner.Services
|
||||
private readonly IConsulClient _consulClient;
|
||||
private readonly AgentServiceRegistration _registration;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize consul hosted service.
|
||||
/// </summary>
|
||||
/// <param name="consulClient">Consul client.</param>
|
||||
/// <param name="scanBackend">Scan backend.</param>
|
||||
public ConsulHostedService(
|
||||
IConsulClient consulClient,
|
||||
IConfiguration configuration,
|
||||
IScanBackend scanBackend)
|
||||
{
|
||||
_consulClient = consulClient;
|
||||
@@ -28,7 +34,7 @@ namespace MalwareMultiScan.Scanner.Services
|
||||
_registration = new AgentServiceRegistration
|
||||
{
|
||||
ID = ServiceId,
|
||||
Name = configuration.GetValue<string>("CONSUL_SERVICE_NAME"),
|
||||
Name = "scanner",
|
||||
|
||||
Meta = new Dictionary<string, string>
|
||||
{
|
||||
|
Reference in New Issue
Block a user