Methoden hinzugefügt, um DiP-Modus und kombinierten Dev- oder DiP-Modus zu prüfen.
This commit is contained in:
parent
0138fb5166
commit
c559662286
@ -19,5 +19,33 @@ namespace DigitalData.Core.API
|
||||
/// <returns>The application builder with the CSP middleware added.</returns>
|
||||
public static IApplicationBuilder UseCSPMiddleware(this IApplicationBuilder app, string policy)
|
||||
=> app.UseMiddleware<CSPMiddleware>(policy);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the DiP (Development in Production) mode is enabled for the WebApplicationBuilder.
|
||||
/// </summary>
|
||||
/// <param name="builder">The WebApplicationBuilder instance.</param>
|
||||
/// <returns>True if DiP mode is enabled; otherwise, false.</returns>
|
||||
public static bool IsDiP(this WebApplicationBuilder builder) => builder.Configuration.GetValue<bool>("DiPMode");
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the DiP (Development in Production) mode is enabled for the WebApplication.
|
||||
/// </summary>
|
||||
/// <param name="app">The WebApplication instance.</param>
|
||||
/// <returns>True if DiP mode is enabled; otherwise, false.</returns>
|
||||
public static bool IsDiP(this WebApplication app) => app.Configuration.GetValue<bool>("DiPMode");
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the environment is Development or DiP (Development in Production) mode is enabled for the WebApplicationBuilder.
|
||||
/// </summary>
|
||||
/// <param name="builder">The WebApplicationBuilder instance.</param>
|
||||
/// <returns>True if the environment is Development or DiP mode is enabled; otherwise, false.</returns>
|
||||
public static bool IsDevOrDiP(this WebApplicationBuilder builder) => builder.Environment.IsDevelopment() || builder.IsDiP();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the environment is Development or DiP (Development in Production) mode is enabled for the WebApplication.
|
||||
/// </summary>
|
||||
/// <param name="app">The WebApplication instance.</param>
|
||||
/// <returns>True if the environment is Development or DiP mode is enabled; otherwise, false.</returns>
|
||||
public static bool IsDevOrDiP(this WebApplication app) => app.Environment.IsDevelopment() || app.IsDiP();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user