Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CulinaryCommandApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,10 @@
// =====================
// AI Services
// =====================
builder.Services.AddSingleton<Client>(sp =>
{
var apiKey = builder.Configuration["Google:ApiKey"]
?? throw new InvalidOperationException("Google:ApiKey is not configured.");
return new Client(apiKey: apiKey);
});
var googleApiKey = builder.Configuration["Google:ApiKey"]
?? Environment.GetEnvironmentVariable("GOOGLE_API_KEY")
?? throw new InvalidOperationException("Missing config: Google:ApiKey (or GOOGLE_API_KEY env var).");
builder.Services.AddSingleton<Client>(new Client(apiKey: googleApiKey));
builder.Services.AddScoped<AIReportingService>();

//
Expand Down
Loading