Skip to content

Commit

Permalink
Merge pull request #2236 from DamianEdwards/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
domaindrivendev committed Sep 22, 2021
2 parents 923c7e6 + 51b77f1 commit c77edfd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public static IApplicationBuilder UseSwaggerUI(this IApplicationBuilder app, Swa
// To simplify the common case, use a default that will work with the SwaggerMiddleware defaults
if (options.ConfigObject.Urls == null)
{
options.ConfigObject.Urls = new[] { new UrlDescriptor { Name = "V1 Docs", Url = "v1/swagger.json" } };
var hostingEnv = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();

options.ConfigObject.Urls = new[] { new UrlDescriptor { Name = $"{hostingEnv.ApplicationName} v1", Url = "v1/swagger.json" } };
}

return app.UseSwaggerUI(options);
Expand Down

0 comments on commit c77edfd

Please sign in to comment.