From 72c74760322dba4ef22100bb2534615738da87b6 Mon Sep 17 00:00:00 2001 From: lucas-mrq Date: Tue, 12 Mar 2024 14:22:08 +0100 Subject: [PATCH] Fix command issue Fix #1458 --- .../Services/LoRaWanManagementService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)