Skip to content

Commit bb62b0b

Browse files
Rick-Andersoncommonsensesoftware
authored andcommitted
use IsDevelopment
1 parent 06c47d5 commit bb62b0b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/AspNetCore/OData/ODataOpenApiExample/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
}
9090

9191
app.UseSwagger();
92+
if ( app.Environment.IsDevelopment() )
93+
{
9294
app.UseSwaggerUI(
9395
options =>
9496
{
@@ -102,6 +104,7 @@
102104
options.SwaggerEndpoint( url, name );
103105
}
104106
} );
107+
}
105108

106109
app.UseHttpsRedirection();
107110
app.UseAuthorization();

examples/AspNetCore/WebApi/OpenApiExample/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
// Configure the HTTP request pipeline.
5858

5959
app.UseSwagger();
60-
app.UseSwaggerUI(
60+
if ( app.Environment.IsDevelopment() )
61+
{
62+
app.UseSwaggerUI(
6163
options =>
6264
{
6365
var descriptions = app.DescribeApiVersions();
@@ -70,6 +72,7 @@
7072
options.SwaggerEndpoint( url, name );
7173
}
7274
} );
75+
}
7376

7477
app.UseHttpsRedirection();
7578
app.UseAuthorization();

0 commit comments

Comments
 (0)