-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ider (#1972) * #1925 & #1928 Specific config handler and throw error if no CloudProvider - Add AWS & Azure specific config handlers - Add AWSS3Storage configuration - Throw exception if CloudProvider undefined or unknown * #1925 - Missing TU for AWSS3StorageConnectionString in DevConfig * #1925 Null reference - Add ! for null reference possible
- Loading branch information
1 parent
ea54778
commit f0efa9c
Showing
18 changed files
with
532 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/AzureIoTHub.Portal.Domain/Exceptions/InvalidCloudProviderException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Domain.Exceptions | ||
{ | ||
using System; | ||
using AzureIoTHub.Portal.Domain.Shared.Constants; | ||
|
||
public class InvalidCloudProviderException : BaseException | ||
{ | ||
public InvalidCloudProviderException(string detail, Exception? innerException = null) : base(ErrorTitles.InvalidCloudProvider, detail, innerException) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/AzureIoTHub.Portal.Infrastructure/ProductionAWSConfigHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace AzureIoTHub.Portal.Infrastructure | ||
{ | ||
using AzureIoTHub.Portal.Domain.Shared.Constants; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
internal class ProductionAWSConfigHandler : ConfigHandlerBase | ||
{ | ||
private readonly IConfiguration config; | ||
|
||
internal ProductionAWSConfigHandler(IConfiguration config) | ||
{ | ||
this.config = config; | ||
} | ||
|
||
public override string PortalName => this.config[PortalNameKey]!; | ||
|
||
public override int SyncDatabaseJobRefreshIntervalInMinutes => this.config.GetValue(SyncDatabaseJobRefreshIntervalKey, 5); | ||
|
||
public override int MetricExporterRefreshIntervalInSeconds => this.config.GetValue(MetricExporterRefreshIntervalKey, 30); | ||
|
||
public override int MetricLoaderRefreshIntervalInMinutes => this.config.GetValue(MetricLoaderRefreshIntervalKey, 10); | ||
|
||
public override string IoTHubConnectionString => this.config[IoTHubConnectionStringKey]!; | ||
|
||
public override string IoTHubEventHubEndpoint => this.config.GetValue(IoTHubEventHubEndpointKey, string.Empty)!; | ||
|
||
public override string IoTHubEventHubConsumerGroup => this.config.GetValue(IoTHubEventHubConsumerGroupKey, "iothub-portal")!; | ||
|
||
public override string DPSConnectionString => this.config[DPSConnectionStringKey]!; | ||
|
||
public override string DPSEndpoint => this.config[DPSServiceEndpointKey]!; | ||
|
||
public override string DPSScopeID => this.config[DPSIDScopeKey]!; | ||
|
||
public override string StorageAccountConnectionString => throw new NotImplementedException(); | ||
|
||
public override int StorageAccountDeviceModelImageMaxAge => throw new NotImplementedException(); | ||
|
||
public override bool UseSecurityHeaders => this.config.GetValue(UseSecurityHeadersKey, true); | ||
|
||
public override string OIDCScope => this.config[OIDCScopeKey]!; | ||
|
||
public override string OIDCAuthority => this.config[OIDCAuthorityKey]!; | ||
|
||
public override string OIDCMetadataUrl => this.config[OIDCMetadataUrlKey]!; | ||
|
||
public override string OIDCClientId => this.config[OIDCClientIdKey]!; | ||
|
||
public override string OIDCApiClientId => this.config[OIDCApiClientIdKey]!; | ||
|
||
public override bool OIDCValidateIssuer => this.config.GetValue(OIDCValidateIssuerKey, true); | ||
|
||
public override bool OIDCValidateAudience => this.config.GetValue(OIDCValidateAudienceKey, true); | ||
|
||
public override bool OIDCValidateLifetime => this.config.GetValue(OIDCValidateLifetimeKey, true); | ||
|
||
public override bool OIDCValidateIssuerSigningKey => this.config.GetValue(OIDCValidateIssuerSigningKeyKey, true); | ||
|
||
public override bool OIDCValidateActor => this.config.GetValue(OIDCValidateActorKey, false); | ||
|
||
public override bool OIDCValidateTokenReplay => this.config.GetValue(OIDCValidateTokenReplayKey, false); | ||
|
||
public override bool IsLoRaEnabled => bool.Parse(this.config[IsLoRaFeatureEnabledKey] ?? "true"); | ||
|
||
public override string LoRaKeyManagementUrl => this.config[LoRaKeyManagementUrlKey]!; | ||
|
||
public override string LoRaKeyManagementCode => this.config[LoRaKeyManagementCodeKey]!; | ||
|
||
public override string LoRaKeyManagementApiVersion => this.config[LoRaKeyManagementApiVersionKey]!; | ||
|
||
public override bool IdeasEnabled => this.config.GetValue(IdeasEnabledKey, false); | ||
public override string IdeasUrl => this.config.GetValue(IdeasUrlKey, string.Empty)!; | ||
public override string IdeasAuthenticationHeader => this.config.GetValue(IdeasAuthenticationHeaderKey, "Ocp-Apim-Subscription-Key")!; | ||
public override string IdeasAuthenticationToken => this.config.GetValue(IdeasAuthenticationTokenKey, string.Empty)!; | ||
|
||
public override string PostgreSQLConnectionString => this.config[PostgreSQLConnectionStringKey]!; | ||
|
||
public override string MySQLConnectionString => this.config[MySQLConnectionStringKey]!; | ||
|
||
public override string DbProvider => this.config.GetValue(DbProviderKey, DbProviders.PostgreSQL)!; | ||
|
||
public override string CloudProvider => this.config[CloudProviderKey]!; | ||
|
||
public override string AWSAccess => this.config[AWSAccessKey]!; | ||
public override string AWSAccessSecret => this.config[AWSAccessSecretKey]!; | ||
public override string AWSRegion => this.config[AWSRegionKey]!; | ||
public override string AWSS3StorageConnectionString => this.config[AWSS3StorageConnectionStringKey]!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.