|
| 1 | +// Copyright (c) Six Labors. |
| 2 | +// Licensed under the Six Labors Split License. |
| 3 | + |
| 4 | +using Amazon.S3; |
| 5 | +using Microsoft.Extensions.DependencyInjection; |
| 6 | +using SixLabors.ImageSharp.Web.Caching.AWS; |
| 7 | +using SixLabors.ImageSharp.Web.DependencyInjection; |
| 8 | +using SixLabors.ImageSharp.Web.Providers.AWS; |
| 9 | + |
| 10 | +namespace SixLabors.ImageSharp.Web.Tests.TestUtilities; |
| 11 | + |
| 12 | +public class AWSS3StorageCacheCacheFolderTestServerFixture : TestServerFixture |
| 13 | +{ |
| 14 | + protected override void ConfigureCustomServices(IServiceCollection services, IImageSharpBuilder builder) |
| 15 | + => builder |
| 16 | + .Configure<AWSS3StorageImageProviderOptions>(o => |
| 17 | + o.S3Buckets.Add( |
| 18 | + new AWSS3BucketClientOptions |
| 19 | + { |
| 20 | + Endpoint = TestConstants.AWSEndpoint, |
| 21 | + BucketName = TestConstants.AWSBucketName, |
| 22 | + AccessKey = TestConstants.AWSAccessKey, |
| 23 | + AccessSecret = TestConstants.AWSAccessSecret, |
| 24 | + Region = TestConstants.AWSRegion, |
| 25 | + Timeout = TestConstants.AWSTimeout, |
| 26 | + })) |
| 27 | + .AddProvider(AWSS3StorageImageProviderFactory.Create) |
| 28 | + .Configure<AWSS3StorageCacheOptions>(o => |
| 29 | + { |
| 30 | + o.Endpoint = TestConstants.AWSEndpoint; |
| 31 | + o.BucketName = TestConstants.AWSCacheBucketName; |
| 32 | + o.AccessKey = TestConstants.AWSAccessKey; |
| 33 | + o.AccessSecret = TestConstants.AWSAccessSecret; |
| 34 | + o.Region = TestConstants.AWSRegion; |
| 35 | + o.Timeout = TestConstants.AWSTimeout; |
| 36 | + o.CacheFolder = TestConstants.AWSCacheFolder; |
| 37 | + |
| 38 | + AWSS3StorageCache.CreateIfNotExists(o, S3CannedACL.Private); |
| 39 | + }) |
| 40 | + .SetCache<AWSS3StorageCache>(); |
| 41 | +} |
0 commit comments