Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Hotfix from 2.7.1 #1065

Merged
merged 3 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ dotnet_diagnostic.IDE1003.severity=suggestion
dotnet_diagnostic.IDE1004.severity=suggestion
dotnet_diagnostic.IDE1007.severity=suggestion
dotnet_diagnostic.IDE1008.severity=suggestion
dotnet_diagnostic.IDE0220.severity=warning

# Enforce file header
dotnet_diagnostic.IDE0073.severity = error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private DevelopmentConfigHandler CreateDevelopmentConfigHandler()
[TestCase(ConfigHandler.OIDCApiClientIdKey, nameof(ConfigHandler.OIDCApiClientId))]
[TestCase(ConfigHandler.LoRaKeyManagementUrlKey, nameof(ConfigHandler.LoRaKeyManagementUrl))]
[TestCase(ConfigHandler.LoRaKeyManagementCodeKey, nameof(ConfigHandler.LoRaKeyManagementCode))]
[TestCase(ConfigHandler.LoRaKeyManagementApiVersionKey, nameof(ConfigHandler.LoRaKeyManagementApiVersion))]
[TestCase(ConfigHandler.IoTHubConnectionStringKey, nameof(ConfigHandler.IoTHubConnectionString))]
[TestCase(ConfigHandler.DPSConnectionStringKey, nameof(ConfigHandler.DPSConnectionString))]
[TestCase(ConfigHandler.StorageAccountConnectionStringKey, nameof(ConfigHandler.StorageAccountConnectionString))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void SecretsShouldGetValueFromConnectionStrings(string configKey, string
[TestCase(ConfigHandler.OIDCClientIdKey, nameof(ConfigHandler.OIDCClientId))]
[TestCase(ConfigHandler.OIDCApiClientIdKey, nameof(ConfigHandler.OIDCApiClientId))]
[TestCase(ConfigHandler.LoRaKeyManagementUrlKey, nameof(ConfigHandler.LoRaKeyManagementUrl))]
[TestCase(ConfigHandler.LoRaKeyManagementApiVersionKey, nameof(ConfigHandler.LoRaKeyManagementApiVersion))]
public void SettingsShouldGetValueFromAppSettings(string configKey, string configPropertyName)
{
// Arrange
Expand Down
3 changes: 3 additions & 0 deletions src/AzureIoTHub.Portal/Server/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public abstract class ConfigHandler

internal const string LoRaKeyManagementUrlKey = "LoRaKeyManagement:Url";
internal const string LoRaKeyManagementCodeKey = "LoRaKeyManagement:Code";
internal const string LoRaKeyManagementApiVersionKey = "LoRaKeyManagement:ApiVersion";

internal const string MetricExporterRefreshIntervalKey = "Metrics:ExporterRefreshIntervalInSeconds";
internal const string MetricLoaderRefreshIntervalKey = "Metrics:LoaderRefreshIntervalInMinutes";
Expand Down Expand Up @@ -100,6 +101,8 @@ internal static ConfigHandler Create(IWebHostEnvironment env, IConfiguration con

internal abstract string LoRaKeyManagementCode { get; }

internal abstract string LoRaKeyManagementApiVersion { get; }

internal abstract string PortalName { get; }

internal abstract int MetricExporterRefreshIntervalInSeconds { get; }
Expand Down
2 changes: 2 additions & 0 deletions src/AzureIoTHub.Portal/Server/DevelopmentConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ internal DevelopmentConfigHandler(IConfiguration config)

internal override string LoRaKeyManagementCode => this.config[LoRaKeyManagementCodeKey];

internal override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey];

internal override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false);
internal override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty);
internal override string IdeasAuthenticationHeader => this.config.GetValue(IdeasAuthenticationHeaderKey, "Ocp-Apim-Subscription-Key");
Expand Down
2 changes: 2 additions & 0 deletions src/AzureIoTHub.Portal/Server/ProductionConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ internal ProductionConfigHandler(IConfiguration config)

internal override string LoRaKeyManagementCode => this.config.GetConnectionString(LoRaKeyManagementCodeKey);

internal override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey];

internal override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false);
internal override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty);
internal override string IdeasAuthenticationHeader => this.config.GetValue(IdeasAuthenticationHeaderKey, "Ocp-Apim-Subscription-Key");
Expand Down
2 changes: 1 addition & 1 deletion src/AzureIoTHub.Portal/Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void ConfigureServices(IServiceCollection services)
{
client.BaseAddress = new Uri(configuration.LoRaKeyManagementUrl);
client.DefaultRequestHeaders.Add("x-functions-key", configuration.LoRaKeyManagementCode);
client.DefaultRequestHeaders.Add("api-version", "2020-10-09");
client.DefaultRequestHeaders.Add("api-version", configuration.LoRaKeyManagementApiVersion ?? "2022-03-04");
})
.AddPolicyHandler(transientHttpErrorPolicy);

Expand Down