From e47856e4bf4fc11a253e63cf1b11d3f01a83bfb5 Mon Sep 17 00:00:00 2001 From: barhen Date: Fri, 22 Dec 2023 14:34:30 -0500 Subject: [PATCH] added a dev environment check --- Cloud_Manager/Program.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Cloud_Manager/Program.cs b/Cloud_Manager/Program.cs index 4d97138..3f710c6 100644 --- a/Cloud_Manager/Program.cs +++ b/Cloud_Manager/Program.cs @@ -42,11 +42,15 @@ builder.Services.AddSwaggerGen(); var app = builder.Build(); - -app.UseSwagger(); -app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SecureSwagger v1")); - -app.UseHttpsRedirection(); +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SecureSwagger v1")); +}else +{ + app.UseHttpsRedirection(); +} app.UseKeyValidation(); app.UseAuthentication();