Uncomment google/amazon code, just disable it in the service registration

This commit is contained in:
nicolas.dorier 2019-04-22 16:45:50 +09:00
parent b184360eb7
commit 5100c36c06
5 changed files with 96 additions and 96 deletions

View File

@ -57,23 +57,23 @@ namespace BTCPayServer.Tests
Assert.Equal(nameof(ServerController.StorageProvider), localResult.ActionName);
Assert.Equal(StorageProvider.FileSystem.ToString(), localResult.RouteValues["provider"]);
//
// var AmazonS3result = Assert
// .IsType<RedirectToActionResult>(controller.Storage(new StorageSettings()
// {
// Provider = StorageProvider.AmazonS3
// }));
// Assert.Equal(nameof(ServerController.StorageProvider), AmazonS3result.ActionName);
// Assert.Equal(StorageProvider.AmazonS3.ToString(), AmazonS3result.RouteValues["provider"]);
//
// var GoogleResult = Assert
// .IsType<RedirectToActionResult>(controller.Storage(new StorageSettings()
// {
// Provider = StorageProvider.GoogleCloudStorage
// }));
// Assert.Equal(nameof(ServerController.StorageProvider), GoogleResult.ActionName);
// Assert.Equal(StorageProvider.GoogleCloudStorage.ToString(), GoogleResult.RouteValues["provider"]);
//
var AmazonS3result = Assert
.IsType<RedirectToActionResult>(controller.Storage(new StorageSettings()
{
Provider = StorageProvider.AmazonS3
}));
Assert.Equal(nameof(ServerController.StorageProvider), AmazonS3result.ActionName);
Assert.Equal(StorageProvider.AmazonS3.ToString(), AmazonS3result.RouteValues["provider"]);
var GoogleResult = Assert
.IsType<RedirectToActionResult>(controller.Storage(new StorageSettings()
{
Provider = StorageProvider.GoogleCloudStorage
}));
Assert.Equal(nameof(ServerController.StorageProvider), GoogleResult.ActionName);
Assert.Equal(StorageProvider.GoogleCloudStorage.ToString(), GoogleResult.RouteValues["provider"]);
var AzureResult = Assert
.IsType<RedirectToActionResult>(controller.Storage(new StorageSettings()

View File

@ -224,13 +224,13 @@ namespace BTCPayServer.Controllers
return View(nameof(EditAzureBlobStorageStorageProvider),
fileProviderService.GetProviderConfiguration(data));
// case AmazonS3FileProviderService fileProviderService:
// return View(nameof(EditAmazonS3StorageProvider),
// fileProviderService.GetProviderConfiguration(data));
//
// case GoogleCloudStorageFileProviderService fileProviderService:
// return View(nameof(EditGoogleCloudStorageStorageProvider),
// fileProviderService.GetProviderConfiguration(data));
case AmazonS3FileProviderService fileProviderService:
return View(nameof(EditAmazonS3StorageProvider),
fileProviderService.GetProviderConfiguration(data));
case GoogleCloudStorageFileProviderService fileProviderService:
return View(nameof(EditGoogleCloudStorageStorageProvider),
fileProviderService.GetProviderConfiguration(data));
case FileSystemFileProviderService fileProviderService:
return View(nameof(EditFileSystemStorageProvider),
@ -247,18 +247,18 @@ namespace BTCPayServer.Controllers
return await SaveStorageProvider(viewModel, BTCPayServer.Storage.Models.StorageProvider.AzureBlobStorage);
}
// [HttpPost("server/storage/AmazonS3")]
// public async Task<IActionResult> EditAmazonS3StorageProvider(AmazonS3StorageConfiguration viewModel)
// {
// return await SaveStorageProvider(viewModel, BTCPayServer.Storage.Models.StorageProvider.AmazonS3);
// }
//
// [HttpPost("server/storage/GoogleCloudStorage")]
// public async Task<IActionResult> EditGoogleCloudStorageStorageProvider(
// GoogleCloudStorageConfiguration viewModel)
// {
// return await SaveStorageProvider(viewModel, BTCPayServer.Storage.Models.StorageProvider.GoogleCloudStorage);
// }
[HttpPost("server/storage/AmazonS3")]
public async Task<IActionResult> EditAmazonS3StorageProvider(AmazonS3StorageConfiguration viewModel)
{
return await SaveStorageProvider(viewModel, BTCPayServer.Storage.Models.StorageProvider.AmazonS3);
}
[HttpPost("server/storage/GoogleCloudStorage")]
public async Task<IActionResult> EditGoogleCloudStorageStorageProvider(
GoogleCloudStorageConfiguration viewModel)
{
return await SaveStorageProvider(viewModel, BTCPayServer.Storage.Models.StorageProvider.GoogleCloudStorage);
}
[HttpPost("server/storage/FileSystem")]
public async Task<IActionResult> EditFileSystemStorageProvider(FileSystemStorageConfiguration viewModel)

View File

@ -3,8 +3,8 @@
public enum StorageProvider
{
AzureBlobStorage=0,
// AmazonS3 =1,
// GoogleCloudStorage =2,
AmazonS3 =1,
GoogleCloudStorage =2,
FileSystem =3
}
}
}

View File

@ -1,27 +1,27 @@
//using System.Threading.Tasks;
//using BTCPayServer.Storage.Models;
//using BTCPayServer.Storage.Services.Providers.AmazonS3Storage.Configuration;
//using TwentyTwenty.Storage;
//using TwentyTwenty.Storage.Amazon;
//
//namespace BTCPayServer.Storage.Services.Providers.AmazonS3Storage
//{
// public class
// AmazonS3FileProviderService : BaseTwentyTwentyStorageFileProviderServiceBase<AmazonS3StorageConfiguration>
// {
// public override StorageProvider StorageProvider()
// {
// return Storage.Models.StorageProvider.AmazonS3;
// }
//
// public override AmazonS3StorageConfiguration GetProviderConfiguration(StorageSettings configuration)
// {
// return configuration.Configuration.ParseAmazonS3StorageConfiguration();
// }
//
// protected override Task<IStorageProvider> GetStorageProvider(AmazonS3StorageConfiguration configuration)
// {
// return Task.FromResult<IStorageProvider>(new AmazonStorageProvider(configuration));
// }
// }
//}
using System.Threading.Tasks;
using BTCPayServer.Storage.Models;
using BTCPayServer.Storage.Services.Providers.AmazonS3Storage.Configuration;
using TwentyTwenty.Storage;
using TwentyTwenty.Storage.Amazon;
namespace BTCPayServer.Storage.Services.Providers.AmazonS3Storage
{
public class
AmazonS3FileProviderService : BaseTwentyTwentyStorageFileProviderServiceBase<AmazonS3StorageConfiguration>
{
public override StorageProvider StorageProvider()
{
return Storage.Models.StorageProvider.AmazonS3;
}
public override AmazonS3StorageConfiguration GetProviderConfiguration(StorageSettings configuration)
{
return configuration.Configuration.ParseAmazonS3StorageConfiguration();
}
protected override Task<IStorageProvider> GetStorageProvider(AmazonS3StorageConfiguration configuration)
{
return Task.FromResult<IStorageProvider>(new AmazonStorageProvider(configuration));
}
}
}

View File

@ -1,30 +1,30 @@
//using System.Threading.Tasks;
//using BTCPayServer.Storage.Models;
//using BTCPayServer.Storage.Services.Providers.GoogleCloudStorage.Configuration;
//using Google.Apis.Auth.OAuth2;
//using TwentyTwenty.Storage;
//using TwentyTwenty.Storage.Google;
//
//namespace BTCPayServer.Storage.Services.Providers.GoogleCloudStorage
//{
// public class
// GoogleCloudStorageFileProviderService : BaseTwentyTwentyStorageFileProviderServiceBase<
// GoogleCloudStorageConfiguration>
// {
// public override StorageProvider StorageProvider()
// {
// return Storage.Models.StorageProvider.GoogleCloudStorage;
// }
//
// public override GoogleCloudStorageConfiguration GetProviderConfiguration(StorageSettings configuration)
// {
// return configuration.Configuration.ParseGoogleCloudStorageConfiguration();
// }
//
// protected override Task<IStorageProvider> GetStorageProvider(
// GoogleCloudStorageConfiguration configuration)
// {
// return Task.FromResult<IStorageProvider>(new GoogleStorageProvider(GoogleCredential.FromJson(configuration.JsonCredentials), configuration));
// }
// }
//}
using System.Threading.Tasks;
using BTCPayServer.Storage.Models;
using BTCPayServer.Storage.Services.Providers.GoogleCloudStorage.Configuration;
using Google.Apis.Auth.OAuth2;
using TwentyTwenty.Storage;
using TwentyTwenty.Storage.Google;
namespace BTCPayServer.Storage.Services.Providers.GoogleCloudStorage
{
public class
GoogleCloudStorageFileProviderService : BaseTwentyTwentyStorageFileProviderServiceBase<
GoogleCloudStorageConfiguration>
{
public override StorageProvider StorageProvider()
{
return Storage.Models.StorageProvider.GoogleCloudStorage;
}
public override GoogleCloudStorageConfiguration GetProviderConfiguration(StorageSettings configuration)
{
return configuration.Configuration.ParseGoogleCloudStorageConfiguration();
}
protected override Task<IStorageProvider> GetStorageProvider(
GoogleCloudStorageConfiguration configuration)
{
return Task.FromResult<IStorageProvider>(new GoogleStorageProvider(GoogleCredential.FromJson(configuration.JsonCredentials), configuration));
}
}
}