Skip to content

Commit

Permalink
use IsDevelopment
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick-Anderson committed Apr 18, 2024
1 parent c7eec94 commit 6478076
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/AspNetCore/OData/ODataOpenApiExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
}

app.UseSwagger();
if ( app.Environment.IsDevelopment() )
{
app.UseSwaggerUI(
options =>
{
Expand All @@ -102,6 +104,7 @@
options.SwaggerEndpoint( url, name );
}
} );
}

app.UseHttpsRedirection();
app.UseAuthorization();
Expand Down
5 changes: 4 additions & 1 deletion examples/AspNetCore/WebApi/OpenApiExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
// Configure the HTTP request pipeline.

app.UseSwagger();
app.UseSwaggerUI(
if ( app.Environment.IsDevelopment() )
{
app.UseSwaggerUI(
options =>
{
var descriptions = app.DescribeApiVersions();
Expand All @@ -70,6 +72,7 @@
options.SwaggerEndpoint( url, name );
}
} );
}

app.UseHttpsRedirection();
app.UseAuthorization();
Expand Down

0 comments on commit 6478076

Please sign in to comment.