Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Minor improvements - move Azure settings to the new class (changes in App_Settings)
support1dd942283a75
diff --git a/src/Business/Grand.Business.Storage/Services/AzurePictureService.cs b/src/Business/Grand.Business.Storage/Services/AzurePictureService.csindex e21002c38..d9aa91e12 100644--- a/src/Business/Grand.Business.Storage/Services/AzurePictureService.cs+++ b/src/Business/Grand.Business.Storage/Services/AzurePictureService.cs@@ -18,8 +18,8 @@ namespace Grand.Business.Storage.Services#region Fieldsprivate static BlobContainerClient container = null;+ private readonly AzureConfig _config;- private readonly AppConfig _config;#endregion#region Ctor@@ -32,7 +32,7 @@ namespace Grand.Business.Storage.ServicesIMediaFileStore mediaFileStore,MediaSettings mediaSettings,StorageSettings storageSettings,- AppConfig config)+ AzureConfig config): base(pictureRepository,logger,mediator,diff --git a/src/Business/Grand.Business.Storage/Startup/StartupApplication.cs b/src/Business/Grand.Business.Storage/Startup/StartupApplication.csindex b7082f132..9cdd7692d 100644--- a/src/Business/Grand.Business.Storage/Startup/StartupApplication.cs+++ b/src/Business/Grand.Business.Storage/Startup/StartupApplication.cs@@ -14,17 +14,15 @@ namespace Grand.Business.Storage.Startup{public void ConfigureServices(IServiceCollection services, IConfiguration configuration){- var config = new AppConfig();- configuration.GetSection("Application").Bind(config);-services.AddScoped<IDownloadService, DownloadService>();//picture service- var useAzureBlobStorage = !string.IsNullOrEmpty(config.AzureBlobStorageConnectionString);+ var azureconfig = new AzureConfig();+ configuration.GetSection("Azure").Bind(azureconfig);+ var useAzureBlobStorage = !string.IsNullOrEmpty(azureconfig.AzureBlobStorageConnectionString);var amazonconfig = new AmazonConfig();configuration.GetSection("Amazon").Bind(amazonconfig);-var useAmazonBlobStorage = (!string.IsNullOrEmpty(amazonconfig.AmazonAwsAccessKeyId) && !string.IsNullOrEmpty(amazonconfig.AmazonAwsSecretAccessKey) && !string.IsNullOrEmpty(amazonconfig.AmazonBucketName) && !string.IsNullOrEmpty(amazonconfig.AmazonRegion));if (useAzureBlobStorage)diff --git a/src/Business/Grand.Business.System/Startup/StartupApplication.cs b/src/Business/Grand.Business.System/Startup/StartupApplication.csindex 48dbf6ad3..6926d6974 100644--- a/src/Business/Grand.Business.System/Startup/StartupApplication.cs+++ b/src/Business/Grand.Business.System/Startup/StartupApplication.cs@@ -26,11 +26,8 @@ namespace Grand.Business.System.Startup{public void ConfigureServices(IServiceCollection services, IConfiguration configuration){- var config = new AppConfig();- configuration.GetSection("Application").Bind(config);-RegisterReports(services);- RegisterMachineNameProvider(services, config);+ RegisterMachineNameProvider(services, configuration);RegisterTask(services);RegisterExportImportService(services);RegisterInstallService(services);@@ -72,8 +69,10 @@ namespace Grand.Business.System.StartupserviceCollection.AddScoped<IProductsReportService, ProductsReportService>();}- private void RegisterMachineNameProvider(IServiceCollection serviceCollection, AppConfig config)+ private void RegisterMachineNameProvider(IServiceCollection serviceCollection, IConfiguration configuration){+ var config = new AzureConfig();+ configuration.GetSection("Azure").Bind(config);if (config.RunOnAzureWebApps){serviceCollection.AddSingleton<IMachineNameProvider, AzureWebAppsMachineNameProvider>();diff --git a/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs b/src/Core/Grand.Infrastructure/Configuration/AppConfig.csindex 1eb75889e..dd7e97ac2 100644--- a/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs+++ b/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs@@ -46,25 +46,7 @@ namespace Grand.Infrastructure.Configuration/// </summary>public bool PluginShadowCopy { get; set; }- /// <summary>- /// A value indicating whether the site is run on Windows Azure Web Apps- /// </summary>- public bool RunOnAzureWebApps { get; set; }-- /// <summary>- /// Connection string for Azure BLOB storage- /// </summary>- public string AzureBlobStorageConnectionString { get; set; }-- /// <summary>- /// Container name for Azure BLOB storage- /// </summary>- public string AzureBlobStorageContainerName { get; set; }- /// <summary>- /// End point for Azure BLOB storage- /// </summary>- public string AzureBlobStorageEndPoint { get; set; }-+/// <summary>/// A list of plugins to be ignored during start application - pattern/// </summary>diff --git a/src/Core/Grand.Infrastructure/Configuration/AzureConfig.cs b/src/Core/Grand.Infrastructure/Configuration/AzureConfig.csnew file mode 100644index 000000000..a3e08d044--- /dev/null+++ b/src/Core/Grand.Infrastructure/Configuration/AzureConfig.cs@@ -0,0 +1,25 @@+namespace Grand.Infrastructure.Configuration+{+ public partial class AzureConfig+ {+ /// <summary>+ /// A value indicating whether the site is run on Windows Azure Web Apps+ /// </summary>+ public bool RunOnAzureWebApps { get; set; }++ /// <summary>+ /// Connection string for Azure BLOB storage+ /// </summary>+ public string AzureBlobStorageConnectionString { get; set; }++ /// <summary>+ /// Container name for Azure BLOB storage+ /// </summary>+ public string AzureBlobStorageContainerName { get; set; }+ /// <summary>+ /// End point for Azure BLOB storage+ /// </summary>+ public string AzureBlobStorageEndPoint { get; set; }++ }+}diff --git a/src/Core/Grand.Infrastructure/StartupBase.cs b/src/Core/Grand.Infrastructure/StartupBase.csindex 18955de84..297c65980 100644--- a/src/Core/Grand.Infrastructure/StartupBase.cs+++ b/src/Core/Grand.Infrastructure/StartupBase.cs@@ -199,6 +199,7 @@ namespace Grand.Infrastructureservices.StartupConfig<GrandWebApiConfig>(configuration.GetSection("GrandWebApi"));services.StartupConfig<LiteDbConfig>(configuration.GetSection("LiteDb"));services.StartupConfig<AmazonConfig>(configuration.GetSection("Amazon"));+ services.StartupConfig<AzureConfig>(configuration.GetSection("Azure"));//set base application pathvar provider = services.BuildServiceProvider();diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.jsonindex 6f3ef6474..a0e0231ae 100644--- a/src/Web/Grand.Web/App_Data/appsettings.json+++ b/src/Web/Grand.Web/App_Data/appsettings.json@@ -54,15 +54,6 @@//Enable the session-based TempData provider"UseSessionStateTempDataProvider": false,- //Enable "RunOnAzureWebApps" if you run on Windows Azure Web Apps- "RunOnAzureWebApps": false,-- //Azure BLOB storage.- //Specify your connection string, container name, end point for BLOB storage here- "AzureBlobStorageConnectionString": "",- "AzureBlobStorageContainerName": "",- "AzureBlobStorageEndPoint": "",-//For developers - more info you can find at https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk///https://github.com/dotnet/roslyn/wiki/Roslyn-Overview"UseRoslynScripts": false,@@ -149,6 +140,16 @@"UrlRewriteHttpsOptionsPort": 443,"UrlRedirectToHttpsPermanent": false},+ "Azure": {+ //Enable "RunOnAzureWebApps" if you run on Windows Azure Web Apps+ "RunOnAzureWebApps": false,++ //Azure BLOB storage.+ //Specify your connection string, container name, end point for BLOB storage here+ "AzureBlobStorageConnectionString": "",+ "AzureBlobStorageContainerName": "",+ "AzureBlobStorageEndPoint": ""+ },"Amazon": {//Amazon Blob storage