mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-11-15 13:07:47 +01:00
29 lines
921 B
C#
29 lines
921 B
C#
using VoidCat.Model;
|
|
using VoidCat.Services.Abstractions;
|
|
using VoidCat.Services.Users;
|
|
|
|
namespace VoidCat.Services.Files;
|
|
|
|
public static class FileStorageStartup
|
|
{
|
|
public static void AddStorage(this IServiceCollection services, VoidSettings settings)
|
|
{
|
|
services.AddTransient<IFileInfoManager, FileInfoManager>();
|
|
services.AddTransient<IUserUploadsStore, UserUploadStore>();
|
|
|
|
if (settings.CloudStorage != default)
|
|
{
|
|
// cloud storage
|
|
if (settings.CloudStorage.S3 != default)
|
|
{
|
|
services.AddSingleton<IFileStore, S3FileStore>();
|
|
services.AddSingleton<IFileMetadataStore, S3FileMetadataStore>();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
services.AddTransient<IFileStore, LocalDiskFileStore>();
|
|
services.AddTransient<IFileMetadataStore, LocalDiskFileMetadataStore>();
|
|
}
|
|
}
|
|
} |