| Name | Message | Date |
|---|---|---|
| 📄 ClientOptions.cs | 1 month ago | |
| 📄 Dtos.cs | 1 month ago | |
| 📄 packages.lock.json | 1 month ago | |
| 📄 ServiceCollectionExtensions.cs | 1 month ago | |
| 📄 Smhi.csproj | 1 month ago | |
| 📄 SmhiClient.cs | 1 month ago |
📄
src/Integrations/Smhi/ServiceCollectionExtensions.cs
using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; namespace MMirror.Integrations.Smhi; public static class ServiceCollectionExtensions { extension(IServiceCollection services) { public IServiceCollection AddSmhiServices() { services.TryAddSingleton(TimeProvider.System); services.AddOptions<ClientOptions>().BindConfiguration("Smhi"); services .AddHttpClient<SmhiClient>() .ConfigureHttpClient( (sp, client) => client.BaseAddress = sp.GetRequiredService<IOptions<ClientOptions>>().Value.BaseAddress ) .AddStandardResilienceHandler(); return services; } } }