Files
mixtape/zero.Core/FileStorage/ServiceCollectionExtensions.cs
T

20 lines
607 B
C#
Raw Normal View History

2021-11-23 22:56:22 +01:00
using Microsoft.AspNetCore.Hosting;
2021-11-25 15:38:36 +01:00
using Microsoft.Extensions.Configuration;
2021-11-23 22:56:22 +01:00
using Microsoft.Extensions.DependencyInjection;
namespace zero.FileStorage;
internal static class ServiceCollectionExtensions
{
2021-11-25 15:38:36 +01:00
public static IServiceCollection AddZeroFileStorage(this IServiceCollection services, IConfiguration config)
2021-11-23 22:56:22 +01:00
{
2021-11-25 15:38:36 +01:00
services.AddScoped<IPaths>(factory => new Paths(factory.GetService<IWebHostEnvironment>()));
services.AddOptions<FileSystemOptions>().Bind(config.GetSection("Zero:FileSystem")).Configure(opts =>
{
opts.ZeroAssetsPath = "zero";
});
2021-11-23 22:56:22 +01:00
return services;
}
}