Skip to content

Commit

Permalink
added azure application insights option (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-tspencer authored Apr 12, 2022
1 parent ff97b55 commit e38005a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Player.Api/Player.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />

<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
7 changes: 7 additions & 0 deletions Player.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add Azure Application Insights, if connection string is supplied
string appInsights = Configuration["ApplicationInsights:ConnectionString"];
if (!string.IsNullOrWhiteSpace(appInsights))
{
services.AddApplicationInsightsTelemetry();
}

var provider = Configuration["Database:Provider"];
switch (provider)
{
Expand Down
3 changes: 3 additions & 0 deletions Player.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"maxSize": "64000000",
"allowedExtensions": [".pdf", ".png", ".jpg", ".jpeg", ".doc", ".docx", ".gif", ".txt"]
},
"ApplicationInsights": {
"ConnectionString": ""
},
"SeedData": {
"Permissions": [
{
Expand Down

0 comments on commit e38005a

Please sign in to comment.