From 72797a8ab40f307f647085f264d7824c5d5421bb Mon Sep 17 00:00:00 2001 From: Vedran B Date: Fri, 10 May 2024 19:06:03 +0200 Subject: [PATCH] 2.8.1 Initial --- NpgsqlRest/MiddlewareExtension.cs | 4 ++-- NpgsqlRest/NpgsqlRest.csproj | 10 +++++----- NpgsqlRestClient/App.cs | 6 ++++++ NpgsqlRestClient/Builder.cs | 3 +++ NpgsqlRestClient/NpgsqlRestClient.csproj | 2 +- NpgsqlRestClient/appsettings.json | 6 +++++- npm/package.json | 2 +- npm/readme.md | 16 ++++++++++------ 8 files changed, 33 insertions(+), 16 deletions(-) diff --git a/NpgsqlRest/MiddlewareExtension.cs b/NpgsqlRest/MiddlewareExtension.cs index 518cb98..072c243 100644 --- a/NpgsqlRest/MiddlewareExtension.cs +++ b/NpgsqlRest/MiddlewareExtension.cs @@ -465,13 +465,13 @@ public static IApplicationBuilder UseNpgsqlRest(this IApplicationBuilder builder { foreach (var header in options.CustomRequestHeaders) { - //context.Request?.Headers?.Append(header); - context.Request?.Headers?.Add(header); + context.Request.Headers.Add(header); } } headers = "{"; var i = 0; + foreach (var header in context.Request.Headers) { if (i++ > 0) diff --git a/NpgsqlRest/NpgsqlRest.csproj b/NpgsqlRest/NpgsqlRest.csproj index e07a78a..1f958b0 100644 --- a/NpgsqlRest/NpgsqlRest.csproj +++ b/NpgsqlRest/NpgsqlRest.csproj @@ -28,10 +28,10 @@ true README.MD bin\$(Configuration)\$(AssemblyName).xml - 2.8.0 - 2.8.0 - 2.8.0 - 2.8.0 + 2.8.1 + 2.8.1 + 2.8.1 + 2.8.1 @@ -40,7 +40,7 @@ - + diff --git a/NpgsqlRestClient/App.cs b/NpgsqlRestClient/App.cs index 672b890..fd7b525 100644 --- a/NpgsqlRestClient/App.cs +++ b/NpgsqlRestClient/App.cs @@ -21,10 +21,16 @@ public static void Configure(WebApplication app, Action started) { app.UseHttpsRedirection(); } + if (UseHsts) + { + app.UseHsts(); + } + if (LogToConsole is true || LogToFile is true) { app.UseSerilogRequestLogging(); } + var cfgCfg = Cfg.GetSection("Config"); var configEndpoint = GetConfigStr("ExposeAsEndpoint", cfgCfg); if (configEndpoint is not null) diff --git a/NpgsqlRestClient/Builder.cs b/NpgsqlRestClient/Builder.cs index 1183f98..fef4afb 100644 --- a/NpgsqlRestClient/Builder.cs +++ b/NpgsqlRestClient/Builder.cs @@ -17,6 +17,7 @@ public static class Builder public static bool LogToFile { get; private set; } = false; public static Serilog.ILogger? Logger { get; private set; } = null; public static bool UseHttpsRedirection { get; private set; } = false; + public static bool UseHsts { get; private set; } = false; public static void BuildInstance() { @@ -49,6 +50,7 @@ public static void BuildInstance() { Instance.WebHost.UseKestrelHttpsConfiguration(); UseHttpsRedirection = GetConfigBool("UseHttpsRedirection", ssqlCfg); + UseHsts = GetConfigBool("UseHsts", ssqlCfg); } } @@ -63,6 +65,7 @@ public static void BuildLogger() LogToFile = false; return; } + Logger = null; LogToConsole = GetConfigBool("ToConsole", logCfg); LogToFile = GetConfigBool("ToFile", logCfg); diff --git a/NpgsqlRestClient/NpgsqlRestClient.csproj b/NpgsqlRestClient/NpgsqlRestClient.csproj index 89a1903..0523138 100644 --- a/NpgsqlRestClient/NpgsqlRestClient.csproj +++ b/NpgsqlRestClient/NpgsqlRestClient.csproj @@ -7,7 +7,7 @@ true true true - 1.2.0 + 1.2.1 diff --git a/NpgsqlRestClient/appsettings.json b/NpgsqlRestClient/appsettings.json index 8d1e883..2e84ceb 100644 --- a/NpgsqlRestClient/appsettings.json +++ b/NpgsqlRestClient/appsettings.json @@ -41,7 +41,11 @@ // // Adds middleware for redirecting HTTP Requests to HTTPS. See https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.httpspolicybuilderextensions.usehttpsredirection?view=aspnetcore-8.0 // - "HttpsRedirection": true + "HttpsRedirection": true, + // + // Adds middleware for using HSTS, which adds the Strict-Transport-Security header. See https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.hstsbuilderextensions.usehsts?view=aspnetcore-2.1 + // + "UseHsts": true }, // // diff --git a/npm/package.json b/npm/package.json index 00dd4a5..97c12dd 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "npgsqlrest", - "version": "1.2.0", + "version": "1.2.1", "description": "Automatic REST API for PostgreSQL Databases Client Build", "scripts": { "postinstall": "node postinstall.js", diff --git a/npm/readme.md b/npm/readme.md index 0f040da..b1b29b0 100644 --- a/npm/readme.md +++ b/npm/readme.md @@ -100,13 +100,9 @@ $ npx npgsqlrest appsettings.json project-config.json See the detailed change log here: [NpgsqlRest Changelog](https://vb-consulting.github.io/npgsqlrest/changelog/) -### 1.1.8 - -Changed the download target from `./node_modules/npgsqlrest/.bin/` to shared bin: `./node_modules/.bin/`. +### 1.2.1 -The reason is that when using the `./node_modules/npgsqlrest/.bin/` directory, I have to use the node spawn process wrapper which slows down the startup time. When the executable is in the `./node_modules/.bin/` it can be invoked directly which is an extremely fast, almost instant startup (a couple of milliseconds). - -But now, I have to use the uninstall script too, to ensure the proper cleanup on the install. +Fix readme ### 1.2.0 @@ -118,6 +114,14 @@ NpgsqlRest.HttpFiles 1.0.2.0 NpgsqlRest.TsClient 1.7.0.0 ``` +### 1.1.8 + +Changed the download target from `./node_modules/npgsqlrest/.bin/` to shared bin: `./node_modules/.bin/`. + +The reason is that when using the `./node_modules/npgsqlrest/.bin/` directory, I have to use the node spawn process wrapper which slows down the startup time. When the executable is in the `./node_modules/.bin/` it can be invoked directly which is an extremely fast, almost instant startup (a couple of milliseconds). + +But now, I have to use the uninstall script too, to ensure the proper cleanup on the install. + ### 1.1.7 Update readme.