Connection Information for Azure Blob storage For ImageSharp

Vote:
 

Hello, we're working with the Optimizely.ImageSharp.Web Library on CMS 12, and it requires Azure Blob Storage connection information for DXP sites. Previously for the Windows based (CMS 11) clients the keys to pull from the Web.config were 'EPiServerAzureBlobs', and there was no blob container needed.  Does anyone know what the keys are for configuration in CMS 12 without a Web.config? 

Github Bug Report

Thanks!

#271304
Edited, Feb 07, 2022 15:40
Vote:
 

Hi,

You should be able to configure this in StartUp.cs, like the DXP-example shows here:

https://github.com/vnbaaij/Baaijte.Optimizely.ImageSharp.Web#configuration-for-use-with-dxp

Basically you specify connection yourself based on what you have configured in appSettings.json.

From appSettings.json:

"ConnectionStrings": {
        "EPiServerDB": "",
        "EcfSqlConnection": "",
        "EPiServerAzureBlobs": "",
        "EPiServerAzureEvents": ""
    }

In StartUp.cs

var blobConnection = _configuration.GetConnectionString("EPiServerAzureBlobs");
imageSharpBuilder.Configure<AzureBlobStorageCacheOptions>(options =>
                {
                    options.ConnectionString = blobConnection;
                    options.ContainerName = "resizer-cache";
                });

imageSharpBuilder.SetCache<AzureBlobStorageCache>();
#271458
Feb 10, 2022 7:35
Maxim Shishov - Feb 18, 2022 17:07
Hi Mari,

I can see classes AzureBlobStorageCacheOptions and AzureBlobStorageCache in your answer. I can't find these classes in my solution. It looks that I missed some package (or using a wrong version of the package). Could you please provide me with a full names these classes?

Thank you in advance.
- Feb 18, 2022 18:07
These classes are part of the ImageSharp library that this original questions refers to: https://github.com/vnbaaij/Baaijte.Optimizely.ImageSharp.Web
Package name: SixLabors.ImageSharp.Web.Providers.Azure
Maxim Shishov - Feb 21, 2022 12:06
Hi Mari,

Thank you! I added package "SixLabors.ImageSharp.Web.Providers.Azure" and it looks OK now.
Vote:
 

Thanks! The connection string worked perfectly, but I wasn't able to use 'resizer-cache' as it wasn't a valid container in my DXP environment? Using the default blob storage container name `mysitemedia` worked perfectly though. Thank you!

#272290
Feb 16, 2022 16:46
- Feb 18, 2022 11:17
Great to hear!

I am not familiar with DXP, but I assume you can ask hosting to create cache container for you?
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.