From c5596622864d6fefed2ec9928566e3b920f61214 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 22 May 2024 13:03:51 +0200 Subject: [PATCH] =?UTF-8?q?Methoden=20hinzugef=C3=BCgt,=20um=20DiP-Modus?= =?UTF-8?q?=20und=20kombinierten=20Dev-=20oder=20DiP-Modus=20zu=20pr=C3=BC?= =?UTF-8?q?fen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.API/DIExtensions.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/DigitalData.Core.API/DIExtensions.cs b/DigitalData.Core.API/DIExtensions.cs index 02b4c25..3a6fa68 100644 --- a/DigitalData.Core.API/DIExtensions.cs +++ b/DigitalData.Core.API/DIExtensions.cs @@ -19,5 +19,33 @@ namespace DigitalData.Core.API /// The application builder with the CSP middleware added. public static IApplicationBuilder UseCSPMiddleware(this IApplicationBuilder app, string policy) => app.UseMiddleware(policy); + + /// + /// Checks if the DiP (Development in Production) mode is enabled for the WebApplicationBuilder. + /// + /// The WebApplicationBuilder instance. + /// True if DiP mode is enabled; otherwise, false. + public static bool IsDiP(this WebApplicationBuilder builder) => builder.Configuration.GetValue("DiPMode"); + + /// + /// Checks if the DiP (Development in Production) mode is enabled for the WebApplication. + /// + /// The WebApplication instance. + /// True if DiP mode is enabled; otherwise, false. + public static bool IsDiP(this WebApplication app) => app.Configuration.GetValue("DiPMode"); + + /// + /// Checks if the environment is Development or DiP (Development in Production) mode is enabled for the WebApplicationBuilder. + /// + /// The WebApplicationBuilder instance. + /// True if the environment is Development or DiP mode is enabled; otherwise, false. + public static bool IsDevOrDiP(this WebApplicationBuilder builder) => builder.Environment.IsDevelopment() || builder.IsDiP(); + + /// + /// Checks if the environment is Development or DiP (Development in Production) mode is enabled for the WebApplication. + /// + /// The WebApplication instance. + /// True if the environment is Development or DiP mode is enabled; otherwise, false. + public static bool IsDevOrDiP(this WebApplication app) => app.Environment.IsDevelopment() || app.IsDiP(); } } \ No newline at end of file