Skip to content

Commit

Permalink
Ignor ssl errors on energy charts api
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinMirMohammadi committed Nov 4, 2024
1 parent 8f88f62 commit b0e211d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Graph" Version="4.50.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarbonAwareComputing.ForecastUpdater\CarbonAwareComputing.ForecastUpdater.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public class ForecastUpdateFunction
public ForecastUpdateFunction(IHttpClientFactory httpClientFactory, IOptions<ApplicationSettings> applicationSettings)
{
m_ApplicationSettings = applicationSettings;

m_Http = httpClientFactory.CreateClient();

}


Expand Down
10 changes: 9 additions & 1 deletion src/CarbonAwareComputing.ForecastUpdater.Function/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ApplicationSettings>()
.Configure<IConfiguration>((settings, configuration) =>
{
Expand Down

0 comments on commit b0e211d

Please sign in to comment.