1
+ using Azure . Core ;
2
+ using Azure . Storage . Blobs ;
1
3
using Microsoft . Extensions . Options ;
2
4
using Umbraco . Cms . Core . Composing ;
3
5
using Umbraco . Cms . Core . Events ;
@@ -8,10 +10,25 @@ namespace Umbraco.StorageProviders.AzureBlob.TestSite;
8
10
9
11
internal sealed class AzureBlobFileSystemComposer : IComposer
10
12
{
13
+ private static readonly BlobClientOptions _blobClientOptions = new BlobClientOptions
14
+ {
15
+ Retry = {
16
+ Mode = RetryMode . Exponential ,
17
+ MaxRetries = 3
18
+ }
19
+ } ;
20
+
11
21
public void Compose ( IUmbracoBuilder builder )
12
22
=> builder
13
- . AddAzureBlobMediaFileSystem ( )
23
+ // Add using default options (overly verbose, but shows how to revert back to the default)
24
+ . AddAzureBlobMediaFileSystem ( options => options . CreateBlobContainerClientUsingDefault ( ) )
25
+ // Add using options
26
+ . AddAzureBlobMediaFileSystem ( options => options . CreateBlobContainerClientUsingOptions ( _blobClientOptions ) )
27
+ // If the connection string is parsed to a URI, use the delegate to create a BlobContainerClient
28
+ . AddAzureBlobMediaFileSystem ( options => options . TryCreateBlobContainerClientUsingUri ( uri => new BlobContainerClient ( uri , _blobClientOptions ) ) )
29
+ // Add the ImageSharp IImageCache implementation using the default media file system and "cache" container root path
14
30
. AddAzureBlobImageSharpCache ( )
31
+ // Add notification handler to create the media file system on install if it doesn't exist
15
32
. AddNotificationHandler < UnattendedInstallNotification , AzureBlobMediaFileSystemCreateIfNotExistsHandler > ( ) ;
16
33
17
34
private sealed class AzureBlobMediaFileSystemCreateIfNotExistsHandler : INotificationHandler < UnattendedInstallNotification >
0 commit comments