public DynamicDnsClient(IHttpClientFactory httpClientFactory, DynamicDnsSettings dynamicDnsSettings, ILogger logger) { _httpClientFactory = httpClientFactory; _dynamicDnsSettings = dynamicDnsSettings; _logger = logger; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var configurationSection = Configuration.GetSection("dynamic-dns"); var settings = new DynamicDnsSettings(); configurationSection.Bind(settings); services.AddSingleton(settings); services.AddControllers(); services.AddHttpClient(); services.AddSingleton <DynamicDnsClient>(); services.AddSingleton <IpFetcher>(); services.AddSingleton <DnsStatus>(); services.AddSingleton <IHostedService, DynamicDnsBackgroundService>(); }