Skip to content

Commit

Permalink
feat: add logging for CORS origin configuration (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
phob authored Feb 11, 2025
2 parents 4ef1022 + 9ce727d commit 3c1ad9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PlexLocalScan.Api/ServiceCollection/Cors.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
using Serilog;

namespace PlexLocalScan.Api.ServiceCollection;

public static class Cors
{
public static IServiceCollection AddCorsPolicy(this IServiceCollection services)
{
var corsOrigins = Environment.GetEnvironmentVariable("CORS_ORIGINS")?.Split(',') ?? new[] { "http://localhost:3000" };

Log.Information("Configuring CORS policy with origins: {@CorsOrigins}", corsOrigins);

services.AddCors(options =>
options.AddDefaultPolicy(policy =>
policy
Expand Down

0 comments on commit 3c1ad9e

Please sign in to comment.