diff --git a/src/CarbonAwareComputing.ForecastUpdater.Function/CarbonAwareComputing.ForecastUpdater.Function.csproj b/src/CarbonAwareComputing.ForecastUpdater.Function/CarbonAwareComputing.ForecastUpdater.Function.csproj index f5fa4fe..c92a10e 100644 --- a/src/CarbonAwareComputing.ForecastUpdater.Function/CarbonAwareComputing.ForecastUpdater.Function.csproj +++ b/src/CarbonAwareComputing.ForecastUpdater.Function/CarbonAwareComputing.ForecastUpdater.Function.csproj @@ -12,9 +12,10 @@ + - + diff --git a/src/CarbonAwareComputing.ForecastUpdater.Function/ForecastUpdateFunction.cs b/src/CarbonAwareComputing.ForecastUpdater.Function/ForecastUpdateFunction.cs index 12930ba..b816245 100644 --- a/src/CarbonAwareComputing.ForecastUpdater.Function/ForecastUpdateFunction.cs +++ b/src/CarbonAwareComputing.ForecastUpdater.Function/ForecastUpdateFunction.cs @@ -30,7 +30,9 @@ public class ForecastUpdateFunction public ForecastUpdateFunction(IHttpClientFactory httpClientFactory, IOptions applicationSettings) { m_ApplicationSettings = applicationSettings; + m_Http = httpClientFactory.CreateClient(); + } diff --git a/src/CarbonAwareComputing.ForecastUpdater.Function/Startup.cs b/src/CarbonAwareComputing.ForecastUpdater.Function/Startup.cs index f5603bc..d56e37d 100644 --- a/src/CarbonAwareComputing.ForecastUpdater.Function/Startup.cs +++ b/src/CarbonAwareComputing.ForecastUpdater.Function/Startup.cs @@ -3,6 +3,8 @@ using Microsoft.Extensions.DependencyInjection; using System.Reflection; using System; +using System.Net.Http; +using Microsoft.Extensions.Options; [assembly: FunctionsStartup(typeof(CarbonAwareComputing.ForecastUpdater.Function.Startup))] namespace CarbonAwareComputing.ForecastUpdater.Function; @@ -13,7 +15,13 @@ public override void Configure(IFunctionsHostBuilder builder) // Note: Only register dependencies, do not depend or request those in Configure(). // Dependencies are only usable during function execution, not before (like here). - builder.Services.AddHttpClient(); + builder.Services.AddHttpClient(Options.DefaultName).ConfigurePrimaryHttpMessageHandler(() => + { + return new HttpClientHandler + { + ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, certChain, policyErrors) => true + }; + }); builder.Services.AddOptions() .Configure((settings, configuration) => {