diff --git a/src/IoTHub.Portal.Infrastructure/Services/LoRaWanManagementService.cs b/src/IoTHub.Portal.Infrastructure/Services/LoRaWanManagementService.cs index dd4e7efce..047e9a648 100644 --- a/src/IoTHub.Portal.Infrastructure/Services/LoRaWanManagementService.cs +++ b/src/IoTHub.Portal.Infrastructure/Services/LoRaWanManagementService.cs @@ -10,15 +10,20 @@ namespace IoTHub.Portal.Infrastructure.Services using System.Text.Json; using System.Threading.Tasks; using IoTHub.Portal.Application.Services; + using IoTHub.Portal.Domain.Options; using IoTHub.Portal.Models.v10.LoRaWAN; + using Microsoft.Extensions.Options; internal class LoRaWanManagementService : ILoRaWanManagementService { private readonly HttpClient httpClient; - public LoRaWanManagementService(HttpClient httpClient) + public LoRaWanManagementService(HttpClient httpClient, IOptions loRaWANOptions) { this.httpClient = httpClient; + this.httpClient.BaseAddress = new Uri(loRaWANOptions?.Value.KeyManagementUrl); + this.httpClient.DefaultRequestHeaders.Add("x-functions-key", loRaWANOptions?.Value.KeyManagementCode); + this.httpClient.DefaultRequestHeaders.Add("api-version", "2022-03-04"); } public async Task GetRouterConfig(string loRaRegion)