You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
The commented portion was my attempt to restrict Swagger if the env variable is not NSAV. This variable is set by Azure. So basically if its in production server, it will not start swagger at all. If its on our dev (NSAV) server, then client can use the swagger.
I did see an example here, but that was for .Net Core and not for my usecase. Any suggestions?
The text was updated successfully, but these errors were encountered:
VERSION:
5.6
My code is a .Net REST call sitting on IIS. So its not a service. Here is my SwaggerConfig.cs
`
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
namespace myRESTService
{
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
//string env = ConfigurationManager.AppSettings["Environment"];
//if (env != "NSAV")
//{
// return;
//}
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "myRESTService");
c.IncludeXmlComments(GetXmlCommentsPath());
c.OperationFilter();
})
.EnableSwaggerUi(c =>
{
c.EnableApiKeySupport("Authorization", "header");
});
}
`
The commented portion was my attempt to restrict Swagger if the env variable is not NSAV. This variable is set by Azure. So basically if its in production server, it will not start swagger at all. If its on our dev (NSAV) server, then client can use the swagger.
I did see an example here, but that was for .Net Core and not for my usecase. Any suggestions?
The text was updated successfully, but these errors were encountered: