Skip to content

Commit

Permalink
CI dummy appinsights connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
chullybun committed Oct 26, 2023
1 parent 9f45ef7 commit 2bf32c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Set environment variables
run: |
echo "DO_NOT_USE_APPINSIGHTS=true" >> $GITHUB_ENV
echp "APPLICATIONINSIGHTS_CONNECTION_STRING=rubbish-to-see-what-happens" >> $GITHUB_ENV"
echo "My_Hr_ConnectionStrings__Database=Data Source=localhost,1433;Initial Catalog=My.Hr;User id=sa;Password=sAPWD23.^0;TrustServerCertificate=true" >> $GITHUB_ENV
echo "MyEf_Hr_ConnectionStrings__Database=Data Source=localhost,1433;Initial Catalog=MyEf.Hr;User id=sa;Password=sAPWD23.^0;TrustServerCertificate=true" >> $GITHUB_ENV
Expand All @@ -142,5 +142,5 @@ jobs:

- name: Verify 'Samples/MyEf.Hr' testing
run: |
dotnet test ./samples/MyEf.Hr/MyEf.Hr.Test --no-build --verbosity normal
dotnet test ./samples/MyEf.Hr/MyEf.Hr.Security.Test --no-build --verbosity normal
dotnet test ./samples/MyEf.Hr/MyEf.Hr.Test --no-build --verbosity normal
dotnet test ./samples/MyEf.Hr/MyEf.Hr.Security.Test --no-build --verbosity normal
11 changes: 4 additions & 7 deletions samples/MyEf.Hr/MyEf.Hr.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ public void ConfigureServices(IServiceCollection services)
services.AddHttpClient();

// Add Azure monitor open telemetry.
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DO_NOT_USE_APPINSIGHTS")))
{
services.AddOpenTelemetry().UseAzureMonitor();
services.Configure<AspNetCoreInstrumentationOptions>(options => options.RecordException = true);
services.Configure<EntityFrameworkInstrumentationOptions>(options => options.SetDbStatementForText = true);
services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddSource("CoreEx.*", "MyEf.Hr.*", "Microsoft.EntityFrameworkCore.*", "EntityFrameworkCore.*"));
}
services.AddOpenTelemetry().UseAzureMonitor();
services.Configure<AspNetCoreInstrumentationOptions>(options => options.RecordException = true);
services.Configure<EntityFrameworkInstrumentationOptions>(options => options.SetDbStatementForText = true);
services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddSource("CoreEx.*", "MyEf.Hr.*", "Microsoft.EntityFrameworkCore.*", "EntityFrameworkCore.*"));

// Add Swagger services.
services.AddSwaggerGen(options =>
Expand Down

0 comments on commit 2bf32c9

Please sign in to comment.