-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken AddMinio(...) method: Endpoint turns back to default #873
Comments
Workaround is pretty simple, we need to call services.AddMinio(o =>
{
o.WithEndpoint("my.s3.com")
.WithCredentials(
Environment.GetEnvironmentVariable(s3AccessKeyEnv),
Environment.GetEnvironmentVariable(s3SecretKeyEnv)
)
.Build(); // Add this line to workaround this issue
},
ServiceLifetime.Scoped
); |
Calling |
If this works as expected, then you might want to update the documentation per the Readme // Add Minio using the custom endpoint and configure additional settings for default MinioClient initialization
builder.Services.AddMinio(configureClient => configureClient
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)); |
One caveat to this. The .WithCredentials(accessKey, secretKey)) actually works without calling .Build(), which might have confused the issue. When refactoring this out to a separate class for keeping Program clean, another example could be // Add Minio using the custom endpoint and configure additional settings for default MinioClient initialization
services.AddMinio(configureClient => configureClient
.WithEndpoint(config["APIs:Minio:Endpoint"])
.WithCredentials(config["APIs:Minio:AccessKey"], config["APIs:Minio:SecretKey"])
.WithSSL(true)
.Build()); |
Good point! |
Clarification: Although |
I connect Minio sdk in my services this way:
But when I try to use API through IMinioClient I have 'play.min.io' as an endpoint.
A little dig inside shows that in this code line we should also pass
configureClient
.https://github.com/minio/minio-dotnet/blob/master/Minio/ServiceCollectionExtensions.cs#L47
And here Endpoint goes back to 'play.min.io':
https://github.com/minio/minio-dotnet/blob/master/Minio/MinioClientFactory.cs#L45
UPD: Minio version: 6.0.0
The text was updated successfully, but these errors were encountered: