aboutsummaryrefslogtreecommitdiff
path: root/dropped/docker/crupest-api/CrupestApi/CrupestApi.Todos/TodosServiceCollectionExtensions.cs
blob: a49d55db5bff1b2cc355a0eeec4b028d1a52bbd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace CrupestApi.Todos;

public static class TodosServiceCollectionExtensions
{
    public static IServiceCollection AddTodos(this IServiceCollection services)
    {
        services.AddOptions<TodosConfiguration>().BindConfiguration("CrupestApi:Todos");
        services.PostConfigure<TodosConfiguration>(config =>
        {
            if (config.Count == 0)
            {
                config.Count = 20;
            }
        });
        services.TryAddScoped<TodosService>();
        return services;
    }
}