26 lines
908 B
C#
26 lines
908 B
C#
|
|
using FileService.Application.UploadFile;
|
|
using IM.Commons;
|
|
|
|
namespace FileService.WebApi
|
|
{
|
|
public class ModueInit : IModuleInitializer
|
|
{
|
|
public void Initialize(IServiceCollection services)
|
|
{
|
|
services.AddScoped<UploadFileService>();
|
|
services.AddHttpClient<IGroupAccessService, GroupAccessService>((sp, client) =>
|
|
{
|
|
var configuration = sp.GetRequiredService<IConfiguration>();
|
|
client.BaseAddress = new Uri(configuration["InternalServices:GroupServiceBaseUrl"]
|
|
?? "http://im-group-service:8080/");
|
|
var internalApiKey = configuration["InternalApiKey"];
|
|
if (!string.IsNullOrWhiteSpace(internalApiKey))
|
|
{
|
|
client.DefaultRequestHeaders.Add("X-Internal-Api-Key", internalApiKey);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|