Skip to content

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.

Rename settings (App_Settings)

support07c1fdd45b9a
diff --git a/src/API/Grand.Api/Commands/Handlers/Common/GenerateTokenCommandHandler.cs b/src/API/Grand.Api/Commands/Handlers/Common/GenerateTokenCommandHandler.cs
index f48bd378d..5f8899c47 100644
--- a/src/API/Grand.Api/Commands/Handlers/Common/GenerateTokenCommandHandler.cs
+++ b/src/API/Grand.Api/Commands/Handlers/Common/GenerateTokenCommandHandler.cs
@@ -8,9 +8,9 @@ namespace Grand.Api.Commands.Handlers.Common
{
public class GenerateTokenCommandHandler : IRequestHandler<GenerateTokenCommand, string>
{
- private readonly ApiConfig _apiConfig;
+ private readonly BackendAPIConfig _apiConfig;
- public GenerateTokenCommandHandler(ApiConfig apiConfig)
+ public GenerateTokenCommandHandler(BackendAPIConfig apiConfig)
{
_apiConfig = apiConfig;
}
diff --git a/src/API/Grand.Api/Infrastructure/ApiAuthenticationRegistrar.cs b/src/API/Grand.Api/Infrastructure/ApiAuthenticationRegistrar.cs
index 7a54e6b26..5a2263ca1 100644
--- a/src/API/Grand.Api/Infrastructure/ApiAuthenticationRegistrar.cs
+++ b/src/API/Grand.Api/Infrastructure/ApiAuthenticationRegistrar.cs
@@ -16,8 +16,8 @@ namespace Grand.Api.Infrastructure
{
builder.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, options =>
{
- var config = new ApiConfig();
- configuration.GetSection("Api").Bind(config);
+ var config = new BackendAPIConfig();
+ configuration.GetSection("BackendAPI").Bind(config);
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = config.ValidateIssuer,
diff --git a/src/API/Grand.Api/Infrastructure/DependencyEdmModel.cs b/src/API/Grand.Api/Infrastructure/DependencyEdmModel.cs
index fe72abffa..3d0843321 100644
--- a/src/API/Grand.Api/Infrastructure/DependencyEdmModel.cs
+++ b/src/API/Grand.Api/Infrastructure/DependencyEdmModel.cs
@@ -359,7 +359,7 @@ namespace Grand.Api.Infrastructure
#endregion
}
- public void Register(ODataConventionModelBuilder builder, ApiConfig apiConfig)
+ public void Register(ODataConventionModelBuilder builder, BackendAPIConfig apiConfig)
{
if (apiConfig.SystemModel)
{
diff --git a/src/API/Grand.Api/Infrastructure/DependencyManagement/IDependencyEdmModel.cs b/src/API/Grand.Api/Infrastructure/DependencyManagement/IDependencyEdmModel.cs
index 7748b50cd..259e23805 100644
--- a/src/API/Grand.Api/Infrastructure/DependencyManagement/IDependencyEdmModel.cs
+++ b/src/API/Grand.Api/Infrastructure/DependencyManagement/IDependencyEdmModel.cs
@@ -9,7 +9,7 @@ namespace Grand.Api.Infrastructure.DependencyManagement
/// Register edmmodel
/// </summary>
/// <param name="builder">OData Convention Model Builder</param>
- void Register(ODataConventionModelBuilder builder, ApiConfig apiConfig);
+ void Register(ODataConventionModelBuilder builder, BackendAPIConfig apiConfig);
/// <summary>
/// Order of this dependency implementation
diff --git a/src/API/Grand.Api/Infrastructure/ODataStartup.cs b/src/API/Grand.Api/Infrastructure/ODataStartup.cs
index ca01cef2a..f7b9e8411 100644
--- a/src/API/Grand.Api/Infrastructure/ODataStartup.cs
+++ b/src/API/Grand.Api/Infrastructure/ODataStartup.cs
@@ -24,7 +24,7 @@ namespace Grand.Api.Infrastructure
{
public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)
{
- var apiConfig = application.ApplicationServices.GetService<ApiConfig>();
+ var apiConfig = application.ApplicationServices.GetService<BackendAPIConfig>();
if (apiConfig.Enabled)
{
application.UseCors(Configurations.CorsPolicyName);
@@ -34,7 +34,7 @@ namespace Grand.Api.Infrastructure
public void ConfigureServices(IServiceCollection services,
IConfiguration configuration)
{
- var apiConfig = services.BuildServiceProvider().GetService<ApiConfig>();
+ var apiConfig = services.BuildServiceProvider().GetService<BackendAPIConfig>();
if (apiConfig.Enabled)
{
//register RequestHandler
@@ -61,7 +61,7 @@ namespace Grand.Api.Infrastructure
public bool BeforeConfigure => false;
- private IEdmModel GetEdmModel(ApiConfig apiConfig)
+ private IEdmModel GetEdmModel(BackendAPIConfig apiConfig)
{
var builder = new ODataConventionModelBuilder {
Namespace = Configurations.ODataModelBuilderNamespace
@@ -70,7 +70,7 @@ namespace Grand.Api.Infrastructure
return builder.GetEdmModel();
}
- private void RegisterDependencies(ODataConventionModelBuilder builder, ApiConfig apiConfig)
+ private void RegisterDependencies(ODataConventionModelBuilder builder, BackendAPIConfig apiConfig)
{
var typeFinder = new AppTypeSearcher();
diff --git a/src/API/Grand.Api/Infrastructure/SwaggerStartup.cs b/src/API/Grand.Api/Infrastructure/SwaggerStartup.cs
index 3487d778b..8366da4af 100644
--- a/src/API/Grand.Api/Infrastructure/SwaggerStartup.cs
+++ b/src/API/Grand.Api/Infrastructure/SwaggerStartup.cs
@@ -15,7 +15,7 @@ namespace Grand.Api.Infrastructure
{
public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)
{
- var apiConfig = application.ApplicationServices.GetService<ApiConfig>();
+ var apiConfig = application.ApplicationServices.GetService<BackendAPIConfig>();
if(apiConfig.Enabled)
application.UseODataQueryRequest();
@@ -32,7 +32,7 @@ namespace Grand.Api.Infrastructure
public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
- var apiConfig = services.BuildServiceProvider().GetService<ApiConfig>();
+ var apiConfig = services.BuildServiceProvider().GetService<BackendAPIConfig>();
if (apiConfig.Enabled && apiConfig.UseSwagger)
{
diff --git a/src/API/Grand.Api/Validators/Common/LoginValidator.cs b/src/API/Grand.Api/Validators/Common/LoginValidator.cs
index edea368b8..af5b63c04 100644
--- a/src/API/Grand.Api/Validators/Common/LoginValidator.cs
+++ b/src/API/Grand.Api/Validators/Common/LoginValidator.cs
@@ -12,7 +12,7 @@ namespace Grand.Api.Validators.Common
{
public LoginValidator(
IEnumerable<IValidatorConsumer<LoginModel>> validators,
- ApiConfig apiConfig, ICustomerService customerService, IUserApiService userApiService, IEncryptionService encryptionService)
+ BackendAPIConfig apiConfig, ICustomerService customerService, IUserApiService userApiService, IEncryptionService encryptionService)
: base(validators)
{
if (!apiConfig.Enabled)
diff --git a/src/Core/Grand.Infrastructure/Configuration/ApiConfig.cs b/src/Core/Grand.Infrastructure/Configuration/BackendAPIConfig.cs
similarity index 93%
rename from src/Core/Grand.Infrastructure/Configuration/ApiConfig.cs
rename to src/Core/Grand.Infrastructure/Configuration/BackendAPIConfig.cs
index ee52f7254..460c1b97f 100644
--- a/src/Core/Grand.Infrastructure/Configuration/ApiConfig.cs
+++ b/src/Core/Grand.Infrastructure/Configuration/BackendAPIConfig.cs
@@ -1,6 +1,6 @@
namespace Grand.Infrastructure.Configuration
{
- public partial class ApiConfig
+ public partial class BackendAPIConfig
{
public bool Enabled { get; set; }
public bool UseSwagger { get; set; }
diff --git a/src/Core/Grand.Infrastructure/StartupBase.cs b/src/Core/Grand.Infrastructure/StartupBase.cs
index 04aeda9ac..a54bc5040 100644
--- a/src/Core/Grand.Infrastructure/StartupBase.cs
+++ b/src/Core/Grand.Infrastructure/StartupBase.cs
@@ -197,7 +197,7 @@ namespace Grand.Infrastructure
services.StartupConfig<UrlRewriteConfig>(configuration.GetSection("UrlRewrite"));
services.StartupConfig<RedisConfig>(configuration.GetSection("Redis"));
services.StartupConfig<RabbitConfig>(configuration.GetSection("Rabbit"));
- services.StartupConfig<ApiConfig>(configuration.GetSection("Api"));
+ services.StartupConfig<BackendAPIConfig>(configuration.GetSection("BackendAPI"));
services.StartupConfig<FrontendAPIConfig>(configuration.GetSection("FrontendAPI"));
services.StartupConfig<DatabaseConfig>(configuration.GetSection("Database"));
services.StartupConfig<AmazonConfig>(configuration.GetSection("Amazon"));
diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.json
index ac0635e37..636e3fd89 100644
--- a/src/Web/Grand.Web/App_Data/appsettings.json
+++ b/src/Web/Grand.Web/App_Data/appsettings.json
@@ -213,7 +213,7 @@
"RefreshTokenExpiryInMinutes": 1440
},
//api for admin
- "Api": {
+ "BackendAPI": {
"Enabled": false,
"UseSwagger": false,
"SecretKey": "your private secret key", //at least 16 characters