Skip to content

Commit

Permalink
Prefix Azure specific parameters (#2157)
Browse files Browse the repository at this point in the history
* Hide certificates when getting the magic ommand

* Prefix Azure specific parameters

* Prefix Azure specific parameters

* fix test

---------

Co-authored-by: Kevin BEAUGRAND <contact@kbeaugrand.fr>
  • Loading branch information
ssgueye2 and kbeaugrand committed Jun 20, 2023
1 parent b680791 commit e9d5a4b
Show file tree
Hide file tree
Showing 23 changed files with 120 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
else
{
@if (Credentials.CertificateCredentials != null && string.IsNullOrEmpty(EnrollementScriptCommand))
@if (Credentials.CertificateCredentials != null && !string.IsNullOrEmpty(EnrollementScriptCommand))
{
<MudItem xs="12">
<MudText Style="text-decoration:underline"><b>Certificate Pem</b></MudText>
Expand Down
22 changes: 11 additions & 11 deletions src/AzureIoTHub.Portal.Domain/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ namespace AzureIoTHub.Portal.Domain
{
public abstract class ConfigHandler
{
public abstract string IoTHubConnectionString { get; }
public abstract string AzureIoTHubConnectionString { get; }

public abstract string IoTHubEventHubEndpoint { get; }
public abstract string AzureIoTHubEventHubEndpoint { get; }

public abstract string IoTHubEventHubConsumerGroup { get; }
public abstract string AzureIoTHubEventHubConsumerGroup { get; }

public abstract string DPSConnectionString { get; }
public abstract string AzureDPSConnectionString { get; }

public abstract string DPSEndpoint { get; }
public abstract string AzureDPSEndpoint { get; }

public abstract string DPSScopeID { get; }
public abstract string AzureDPSScopeID { get; }

public abstract string StorageAccountConnectionString { get; }
public abstract string AzureStorageAccountConnectionString { get; }

public abstract int StorageAccountDeviceModelImageMaxAge { get; }

Expand Down Expand Up @@ -45,13 +45,13 @@ public abstract class ConfigHandler

public abstract bool OIDCValidateTokenReplay { get; }

public abstract bool IsLoRaEnabled { get; }
public abstract bool AzureIsLoRaEnabled { get; }

public abstract string LoRaKeyManagementUrl { get; }
public abstract string AzureLoRaKeyManagementUrl { get; }

public abstract string LoRaKeyManagementCode { get; }
public abstract string AzureLoRaKeyManagementCode { get; }

public abstract string LoRaKeyManagementApiVersion { get; }
public abstract string AzureLoRaKeyManagementApiVersion { get; }

public abstract string PortalName { get; }

Expand Down
22 changes: 11 additions & 11 deletions src/AzureIoTHub.Portal.Infrastructure/ConfigHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace AzureIoTHub.Portal.Infrastructure
internal abstract class ConfigHandlerBase : ConfigHandler
{
internal const string PortalNameKey = "PortalName";
internal const string IoTHubConnectionStringKey = "IoTHub:ConnectionString";
internal const string IoTHubEventHubEndpointKey = "IoTHub:EventHub:Endpoint";
internal const string IoTHubEventHubConsumerGroupKey = "IoTHub:EventHub:ConsumerGroup";
internal const string DPSConnectionStringKey = "IoTDPS:ConnectionString";
internal const string DPSServiceEndpointKey = "IoTDPS:ServiceEndpoint";
internal const string DPSIDScopeKey = "IoTDPS:IDScope";
internal const string AzureIoTHubConnectionStringKey = "Azure:IoTHub:ConnectionString";
internal const string AzureIoTHubEventHubEndpointKey = "Azure:IoTHub:EventHub:Endpoint";
internal const string AzureIoTHubEventHubConsumerGroupKey = "Azure:IoTHub:EventHub:ConsumerGroup";
internal const string AzureDPSConnectionStringKey = "Azure:IoTDPS:ConnectionString";
internal const string AzureDPSServiceEndpointKey = "Azure:IoTDPS:ServiceEndpoint";
internal const string AzureDPSIDScopeKey = "Azure:IoTDPS:IDScope";
internal const string UseSecurityHeadersKey = "UseSecurityHeaders";
internal const string PostgreSQLConnectionStringKey = "PostgreSQL:ConnectionString";
internal const string MySQLConnectionStringKey = "MySQL:ConnectionString";
Expand All @@ -31,14 +31,14 @@ internal abstract class ConfigHandlerBase : ConfigHandler
internal const string OIDCValidateActorKey = "OIDC:ValidateActor";
internal const string OIDCValidateTokenReplayKey = "OIDC:ValidateTokenReplay";

internal const string IsLoRaFeatureEnabledKey = "LoRaFeature:Enabled";
internal const string AzureIsLoRaFeatureEnabledKey = "Azure:LoRaFeature:Enabled";

internal const string StorageAccountConnectionStringKey = "StorageAccount:ConnectionString";
internal const string AzureStorageAccountConnectionStringKey = "Azure:StorageAccount:ConnectionString";
internal const string StorageAccountDeviceModelImageMaxAgeKey = "StorageAccount:DeviceModel:Image:MaxAgeInSeconds";

internal const string LoRaKeyManagementUrlKey = "LoRaKeyManagement:Url";
internal const string LoRaKeyManagementCodeKey = "LoRaKeyManagement:Code";
internal const string LoRaKeyManagementApiVersionKey = "LoRaKeyManagement:ApiVersion";
internal const string AzureLoRaKeyManagementUrlKey = "Azure:LoRaKeyManagement:Url";
internal const string AzureLoRaKeyManagementCodeKey = "Azure:LoRaKeyManagement:Code";
internal const string AzureLoRaKeyManagementApiVersionKey = "Azure:LoRaKeyManagement:ApiVersion";

internal const string MetricExporterRefreshIntervalKey = "Metrics:ExporterRefreshIntervalInSeconds";
internal const string MetricLoaderRefreshIntervalKey = "Metrics:LoaderRefreshIntervalInMinutes";
Expand Down
22 changes: 11 additions & 11 deletions src/AzureIoTHub.Portal.Infrastructure/DevelopmentConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ internal DevelopmentConfigHandler(IConfiguration config)

public override int MetricLoaderRefreshIntervalInMinutes => this.config.GetValue(MetricLoaderRefreshIntervalKey, 10);

public override string IoTHubConnectionString => this.config[IoTHubConnectionStringKey]!;
public override string AzureIoTHubConnectionString => this.config[AzureIoTHubConnectionStringKey]!;

public override string IoTHubEventHubEndpoint => this.config.GetValue(IoTHubEventHubEndpointKey, string.Empty)!;
public override string AzureIoTHubEventHubEndpoint => this.config.GetValue(AzureIoTHubEventHubEndpointKey, string.Empty)!;

public override string IoTHubEventHubConsumerGroup => this.config.GetValue(IoTHubEventHubConsumerGroupKey, "iothub-portal")!;
public override string AzureIoTHubEventHubConsumerGroup => this.config.GetValue(AzureIoTHubEventHubConsumerGroupKey, "iothub-portal")!;

public override string DPSConnectionString => this.config[DPSConnectionStringKey]!;
public override string AzureDPSConnectionString => this.config[AzureDPSConnectionStringKey]!;

public override string DPSEndpoint => this.config[DPSServiceEndpointKey]!;
public override string AzureDPSEndpoint => this.config[AzureDPSServiceEndpointKey]!;

public override string DPSScopeID => this.config[DPSIDScopeKey]!;
public override string AzureDPSScopeID => this.config[AzureDPSIDScopeKey]!;

public override string StorageAccountConnectionString => this.config[StorageAccountConnectionStringKey]!;
public override string AzureStorageAccountConnectionString => this.config[AzureStorageAccountConnectionStringKey]!;

public override int StorageAccountDeviceModelImageMaxAge => this.config.GetValue(StorageAccountDeviceModelImageMaxAgeKey, 86400);

Expand Down Expand Up @@ -64,13 +64,13 @@ internal DevelopmentConfigHandler(IConfiguration config)

public override bool OIDCValidateTokenReplay => this.config.GetValue(OIDCValidateTokenReplayKey, false);

public override bool IsLoRaEnabled => bool.Parse(this.config[IsLoRaFeatureEnabledKey] ?? "true");
public override bool AzureIsLoRaEnabled => bool.Parse(this.config[AzureIsLoRaFeatureEnabledKey] ?? "true");

public override string LoRaKeyManagementUrl => this.config[LoRaKeyManagementUrlKey]!;
public override string AzureLoRaKeyManagementUrl => this.config[AzureLoRaKeyManagementUrlKey]!;

public override string LoRaKeyManagementCode => this.config[LoRaKeyManagementCodeKey]!;
public override string AzureLoRaKeyManagementCode => this.config[AzureLoRaKeyManagementCodeKey]!;

public override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey]!;
public override string AzureLoRaKeyManagementApiVersion => this.config[AzureLoRaKeyManagementApiVersionKey]!;

public override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false);
public override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public async Task Execute(IJobExecutionContext context)

var processor = new EventProcessorClient(
storageClient,
this.configHandler.IoTHubEventHubConsumerGroup,
this.configHandler.IoTHubEventHubEndpoint);
this.configHandler.AzureIoTHubEventHubConsumerGroup,
this.configHandler.AzureIoTHubEventHubEndpoint);

try
{
Expand Down
22 changes: 11 additions & 11 deletions src/AzureIoTHub.Portal.Infrastructure/ProductionAWSConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ internal ProductionAWSConfigHandler(IConfiguration config)

public override int MetricLoaderRefreshIntervalInMinutes => this.config.GetValue(MetricLoaderRefreshIntervalKey, 10);

public override string IoTHubConnectionString => this.config[IoTHubConnectionStringKey]!;
public override string AzureIoTHubConnectionString => this.config[AzureIoTHubConnectionStringKey]!;

public override string IoTHubEventHubEndpoint => this.config.GetValue(IoTHubEventHubEndpointKey, string.Empty)!;
public override string AzureIoTHubEventHubEndpoint => this.config.GetValue(AzureIoTHubEventHubEndpointKey, string.Empty)!;

public override string IoTHubEventHubConsumerGroup => this.config.GetValue(IoTHubEventHubConsumerGroupKey, "iothub-portal")!;
public override string AzureIoTHubEventHubConsumerGroup => this.config.GetValue(AzureIoTHubEventHubConsumerGroupKey, "iothub-portal")!;

public override string DPSConnectionString => this.config[DPSConnectionStringKey]!;
public override string AzureDPSConnectionString => this.config[AzureDPSConnectionStringKey]!;

public override string DPSEndpoint => this.config[DPSServiceEndpointKey]!;
public override string AzureDPSEndpoint => this.config[AzureDPSServiceEndpointKey]!;

public override string DPSScopeID => this.config[DPSIDScopeKey]!;
public override string AzureDPSScopeID => this.config[AzureDPSIDScopeKey]!;

public override string StorageAccountConnectionString => throw new NotImplementedException();
public override string AzureStorageAccountConnectionString => throw new NotImplementedException();

public override int StorageAccountDeviceModelImageMaxAge => this.config.GetValue(StorageAccountDeviceModelImageMaxAgeKey, 86400);

Expand Down Expand Up @@ -63,13 +63,13 @@ internal ProductionAWSConfigHandler(IConfiguration config)

public override bool OIDCValidateTokenReplay => this.config.GetValue(OIDCValidateTokenReplayKey, false);

public override bool IsLoRaEnabled => bool.Parse(this.config[IsLoRaFeatureEnabledKey] ?? "true");
public override bool AzureIsLoRaEnabled => bool.Parse(this.config[AzureIsLoRaFeatureEnabledKey] ?? "true");

public override string LoRaKeyManagementUrl => this.config[LoRaKeyManagementUrlKey]!;
public override string AzureLoRaKeyManagementUrl => this.config[AzureLoRaKeyManagementUrlKey]!;

public override string LoRaKeyManagementCode => this.config[LoRaKeyManagementCodeKey]!;
public override string AzureLoRaKeyManagementCode => this.config[AzureLoRaKeyManagementCodeKey]!;

public override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey]!;
public override string AzureLoRaKeyManagementApiVersion => this.config[AzureLoRaKeyManagementApiVersionKey]!;

public override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false);
public override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ internal ProductionAzureConfigHandler(IConfiguration config)

public override int MetricLoaderRefreshIntervalInMinutes => this.config.GetValue(MetricLoaderRefreshIntervalKey, 10);

public override string IoTHubConnectionString => this.config.GetConnectionString(IoTHubConnectionStringKey)!;
public override string AzureIoTHubConnectionString => this.config.GetConnectionString(AzureIoTHubConnectionStringKey)!;

public override string IoTHubEventHubEndpoint => this.config.GetConnectionString(IoTHubEventHubEndpointKey)!;
public override string AzureIoTHubEventHubEndpoint => this.config.GetConnectionString(AzureIoTHubEventHubEndpointKey)!;

public override string IoTHubEventHubConsumerGroup => this.config.GetValue(IoTHubEventHubConsumerGroupKey, "iothub-portal")!;
public override string AzureIoTHubEventHubConsumerGroup => this.config.GetValue(AzureIoTHubEventHubConsumerGroupKey, "iothub-portal")!;

public override string DPSConnectionString => this.config.GetConnectionString(DPSConnectionStringKey)!;
public override string AzureDPSConnectionString => this.config.GetConnectionString(AzureDPSConnectionStringKey)!;

public override string DPSEndpoint => this.config[DPSServiceEndpointKey]!;
public override string AzureDPSEndpoint => this.config[AzureDPSServiceEndpointKey]!;

public override string DPSScopeID => this.config[DPSIDScopeKey]!;
public override string AzureDPSScopeID => this.config[AzureDPSIDScopeKey]!;

public override string StorageAccountConnectionString => this.config.GetConnectionString(StorageAccountConnectionStringKey)!;
public override string AzureStorageAccountConnectionString => this.config.GetConnectionString(AzureStorageAccountConnectionStringKey)!;

public override string PostgreSQLConnectionString => this.config.GetConnectionString(PostgreSQLConnectionStringKey)!;

Expand Down Expand Up @@ -70,13 +70,13 @@ internal ProductionAzureConfigHandler(IConfiguration config)

public override bool OIDCValidateTokenReplay => this.config.GetValue(OIDCValidateTokenReplayKey, false);

public override bool IsLoRaEnabled => bool.Parse(this.config[IsLoRaFeatureEnabledKey] ?? "true");
public override bool AzureIsLoRaEnabled => bool.Parse(this.config[AzureIsLoRaFeatureEnabledKey] ?? "true");

public override string LoRaKeyManagementUrl => this.config[LoRaKeyManagementUrlKey]!;
public override string AzureLoRaKeyManagementUrl => this.config[AzureLoRaKeyManagementUrlKey]!;

public override string LoRaKeyManagementCode => this.config.GetConnectionString(LoRaKeyManagementCodeKey)!;
public override string AzureLoRaKeyManagementCode => this.config.GetConnectionString(AzureLoRaKeyManagementCodeKey)!;

public override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey]!;
public override string AzureLoRaKeyManagementApiVersion => this.config[AzureLoRaKeyManagementApiVersionKey]!;

public override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false);
public override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public async Task<DeviceCredentials> GetEnrollmentCredentialsAsync(string device
{
SymmetricKey = symmetricKey,
RegistrationID = deviceId,
ScopeID = this.config.DPSScopeID,
ProvisioningEndpoint = $"https://{this.config.DPSEndpoint}"
ScopeID = this.config.AzureDPSScopeID,
ProvisioningEndpoint = $"https://{this.config.AzureDPSEndpoint}"
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class DeviceModelCommandSeeder
{
public static async Task MigrateDeviceModelCommands(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetDeviceCommands();

var set = ctx.Set<DeviceModelCommand>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class DeviceModelPropertySeeder
{
public static async Task MigrateDeviceModelProperties(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetDeviceTemplateProperties();

var set = ctx.Set<DeviceModelProperty>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class DeviceModelSeeder
{
public static async Task MigrateDeviceModels(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetDeviceTemplates();

var set = ctx.Set<DeviceModel>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class DeviceTagSeeder
{
public static async Task MigrateDeviceTags(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetDeviceTagSettings();

var set = ctx.Set<DeviceTag>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class EdgeDeviceModelCommandSeeder
{
public static async Task MigrateEdgeDeviceModelCommands(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetEdgeModuleCommands();

var set = ctx.Set<EdgeDeviceModelCommand>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class EdgeDeviceModelSeeder
{
public static async Task MigrateEdgeDeviceModels(this PortalDbContext ctx, ConfigHandler config)
{
var table = new TableClientFactory(config.StorageAccountConnectionString)
var table = new TableClientFactory(config.AzureStorageAccountConnectionString)
.GetEdgeDeviceTemplates();

var set = ctx.Set<EdgeDeviceModel>();
Expand Down
Loading

0 comments on commit e9d5a4b

Please sign in to comment.