forked from SixLabors/ImageSharp.Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAWSS3StorageCacheCacheFolderTestServerFixture.cs
41 lines (37 loc) · 1.63 KB
/
AWSS3StorageCacheCacheFolderTestServerFixture.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
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using Amazon.S3;
using Microsoft.Extensions.DependencyInjection;
using SixLabors.ImageSharp.Web.Caching.AWS;
using SixLabors.ImageSharp.Web.DependencyInjection;
using SixLabors.ImageSharp.Web.Providers.AWS;
namespace SixLabors.ImageSharp.Web.Tests.TestUtilities;
public class AWSS3StorageCacheCacheFolderTestServerFixture : TestServerFixture
{
protected override void ConfigureCustomServices(IServiceCollection services, IImageSharpBuilder builder)
=> builder
.Configure<AWSS3StorageImageProviderOptions>(o =>
o.S3Buckets.Add(
new AWSS3BucketClientOptions
{
Endpoint = TestConstants.AWSEndpoint,
BucketName = TestConstants.AWSBucketName,
AccessKey = TestConstants.AWSAccessKey,
AccessSecret = TestConstants.AWSAccessSecret,
Region = TestConstants.AWSRegion,
Timeout = TestConstants.AWSTimeout,
}))
.AddProvider(AWSS3StorageImageProviderFactory.Create)
.Configure<AWSS3StorageCacheOptions>(o =>
{
o.Endpoint = TestConstants.AWSEndpoint;
o.BucketName = TestConstants.AWSCacheBucketName;
o.AccessKey = TestConstants.AWSAccessKey;
o.AccessSecret = TestConstants.AWSAccessSecret;
o.Region = TestConstants.AWSRegion;
o.Timeout = TestConstants.AWSTimeout;
o.CacheFolder = TestConstants.AWSCacheFolder;
AWSS3StorageCache.CreateIfNotExists(o, S3CannedACL.Private);
})
.SetCache<AWSS3StorageCache>();
}