From 3e001b40f0714b9654673c028e7c8184ae70fbbc Mon Sep 17 00:00:00 2001 From: Unai Date: Mon, 14 Nov 2016 15:48:30 +0100 Subject: [PATCH] Remove unnecesary comments and review settings --- .../Controllers/CatalogController.cs | 1 + src/Services/Catalog/Catalog.API/Startup.cs | 17 +++++++++-------- src/Services/Catalog/Catalog.API/project.json | 2 +- ...{settings.development.json => settings.json} | 0 .../Catalog.API/settings.production.json | 11 ----------- 5 files changed, 11 insertions(+), 20 deletions(-) rename src/Services/Catalog/Catalog.API/{settings.development.json => settings.json} (100%) delete mode 100644 src/Services/Catalog/Catalog.API/settings.production.json diff --git a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs index e178d9bbc..abb0733b3 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs @@ -29,6 +29,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers .LongCountAsync(); var itemsOnPage = await _context.CatalogItems + .OrderBy(c=>c.Name) .Skip(pageSize * pageIndex) .Take(pageSize) .ToListAsync(); diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index c12b03681..7f197a05c 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -17,8 +17,10 @@ { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) - .AddJsonFile($"settings.{env.EnvironmentName}.json", optional: false) - .AddEnvironmentVariables(); + .AddJsonFile($"settings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true); + + builder.AddEnvironmentVariables(); Configuration = builder.Build(); @@ -33,7 +35,8 @@ c.UseSqlServer(Configuration["ConnectionString"]); c.ConfigureWarnings(wb => { - wb.Throw(RelationalEventId.QueryClientEvaluationWarning); + //By default, in this application, we don't want to have client evaluations + wb.Log(RelationalEventId.QueryClientEvaluationWarning); }); }); @@ -45,10 +48,10 @@ options.DescribeAllEnumsAsStrings(); options.SingleApiVersion(new Swashbuckle.Swagger.Model.Info() { - Title = "Values API", + Title = "Catalog HTTP API", Version = "v1", - Description = "An API API With Swagger for RC2", - TermsOfService = "None" + Description = "The Catalog Service HTTP API", + TermsOfService = "Terms Of Service" }); }); @@ -59,10 +62,8 @@ }); } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { - //Configure logs if (env.IsDevelopment()) diff --git a/src/Services/Catalog/Catalog.API/project.json b/src/Services/Catalog/Catalog.API/project.json index 3f735f22a..813301bd7 100644 --- a/src/Services/Catalog/Catalog.API/project.json +++ b/src/Services/Catalog/Catalog.API/project.json @@ -47,7 +47,7 @@ "wwwroot", "Views", "Areas/**/Views", - "settings.Production.json", + "settings.json", "web.config", "project.json", "Dockerfile" diff --git a/src/Services/Catalog/Catalog.API/settings.development.json b/src/Services/Catalog/Catalog.API/settings.json similarity index 100% rename from src/Services/Catalog/Catalog.API/settings.development.json rename to src/Services/Catalog/Catalog.API/settings.json diff --git a/src/Services/Catalog/Catalog.API/settings.production.json b/src/Services/Catalog/Catalog.API/settings.production.json deleted file mode 100644 index 2ca24aa6c..000000000 --- a/src/Services/Catalog/Catalog.API/settings.production.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ConnectionString": "Server=tcp:127.0.0.1,1455;Initial Catalog=CatalogDB;User Id=sa;Password=Pass@word", - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -}