-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathInriverComposer.cs
29 lines (25 loc) · 1.1 KB
/
InriverComposer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Integrations.PIM.Inriver.Configuration;
using Umbraco.Cms.Integrations.PIM.Inriver.Services;
namespace Umbraco.Cms.Integrations.PIM.Inriver
{
public class InriverComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
var options = builder.Services
.AddOptions<InriverSettings>()
.Bind(builder.Config.GetSection(Constants.SettingsPath));
builder.Services
.AddHttpClient(Constants.InriverClient, client =>
{
client.BaseAddress = new Uri($"{builder.Config.GetSection(Constants.SettingsPath)[nameof(InriverSettings.ApiBaseUrl)]}");
client.DefaultRequestHeaders
.Add("X-inRiver-APIKey", builder.Config.GetSection(Constants.SettingsPath)[nameof(InriverSettings.ApiKey)]);
});
builder.Services.AddSingleton<IInriverService, InriverService>();
}
}
}