testcontainers-dotnet icon indicating copy to clipboard operation
testcontainers-dotnet copied to clipboard

[Enhancement]: Support https connection string for Azurite container.

Open nickduch opened this issue 9 months ago • 1 comments

Problem

I need to connect to my Azurite container using an HTTPS connection string.

From Azurite docs, if you start the container with a cert and a key, the container should be accessible using HTTPS. The issue isn't there, the container is running fine, however, in AzuriteContainer (src/Testcontainers.Azurite/AzuriteContainer.cs), the Uri scheme is hardcoded to HTTP and it looks impossible to get the HTTPS variant of that connection string.

Also, the class is sealed so there's no way for me to override this in a, lets say, "AzuriteSslContainer" which could inherit from "AzuriteContainer" to override the GetConnectionString method.

workaround is to hardcode the https connection string in my code which is ugly :)

Solution

Have an HTTPS variant for the AzuriteContainer or simply make the class not sealed and let us do it in our code base.

Benefit

Simpler and cleaner code. Else I need to have my connection string hardcoded instead of calling GetConnectionString on the AzuriteContainer which is the go to solution when I need to access the storage hosted in my local container.

Alternatives

Hardcoded HTTPs connection string in my codebase :(

Would you like to help contributing this enhancement?

Yes

nickduch avatar Apr 28 '25 17:04 nickduch

Thanks for creating the issue. Can you please share how you already configure the container builder and the HTTP client? I assume setting up HTTPS requires quite a bit of customization.

My idea is to provide a builder API that allows configuring HTTPS (cert, key, etc.). If these configurations are provided, then GetConnectionString() returns an HTTPS instead of an HTTP URL.

WDYT?

HofmeisterAn avatar May 02 '25 08:05 HofmeisterAn