Skip to content

Commit

Permalink
Add extension method for configuring GoogleCalendarSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
Edrisym committed Nov 3, 2024
1 parent dfea7e8 commit f61e6db
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();


builder.Services.Configure<GoogleCalendarSettings>(builder.Configuration.GetSection(nameof(GoogleCalendarSettings)));

builder.RegisterSettingService();
builder.Services.AddScoped<IGoogleCalendarService, GoogleCalendarService>();
builder.Services.AddScoped<IOAuthService, OAuthService>();

var app = builder.Build();
app.UseRouting();
app.MapControllers();

app.Run();
app.Run();


public static class AddSetting
{
public static void RegisterSettingService(this WebApplicationBuilder builder)
{
builder.Services.Configure<GoogleCalendarSettings>
(builder.Configuration.GetSection(nameof(GoogleCalendarSettings)));
}
}

0 comments on commit f61e6db

Please sign in to comment.