Skip to content

appany/Minio.AspNetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 24, 2024
d263bb8 Β· Jun 24, 2024
May 7, 2023
Jun 24, 2024
Jan 8, 2024
Mar 26, 2021
May 5, 2023
Mar 7, 2024
Feb 8, 2021
Sep 15, 2023
Jan 7, 2021
May 7, 2023
Jan 8, 2024
May 5, 2023

Repository files navigation

πŸ’₯ Minio.AspNetCore πŸ’₯

License Nuget Downloads Tests codecov

⚑️ Microsoft.Extensions.DependencyInjection and HealthChecks extensions for Minio client ⚑️

πŸ”§ Installation πŸ”§

$> dotnet add package Minio.AspNetCore

🎨 Usage 🎨

βœ… Add MinioClient

services.AddMinio(options =>
{
  options.Endpoint = "endpoint";
  // ...
  options.ConfigureClient(client =>
  {
    client.WithSSL();
  });
});

// Url based configuration
services.AddMinio(new Uri("s3://accessKey:secretKey@localhost:9000/region"));

// Get or inject
var client = serviceProvider.GetRequiredService<MinioClient>();

// Create new from factory
var client = serviceProvider.GetRequiredService<IMinioClientFactory>().CreateClient();

βœ… Multiple clients support using named options

services.AddMinio(options =>
{
  options.Endpoint = "endpoint1";
  // ...
  options.ConfigureClient(client =>
  {
    client.WithSSL();
  });
});

// Named extension overload
services.AddMinio("minio2", options =>
{
  options.Endpoint = "endpoint2";
  // ...
  options.ConfigureClient(client =>
  {
    client.WithSSL().WithTimeout(...);
  });
});

// Explicit named Configure
services.AddMinio()
  .Configure<MinioOptions>("minio3", options =>
  {
    options.Endpoint = "endpoint3";
    // ...
  });

// Get or inject first minio client
var client = serviceProvider.GetRequiredService<MinioClient>();

// Create new minio2
var client = serviceProvider.GetRequiredService<IMinioClientFactory>().CreateClient("minio2");

// Create new minio3
var client = serviceProvider.GetRequiredService<IMinioClientFactory>().CreateClient("minio3");

πŸš‘ HealthChecks πŸš‘

// Minio.AspNetCore.HealthChecks package

services.AddHealthChecks()
  .AddMinio(sp => sp.GetRequiredService<MinioClient>());

services.AddHealthChecks()
  .AddMinio(sp => sp.GetRequiredService<MinioClient>())
  .AddMinio(sp => /* Get named client from cache or create new */);

Breaking changes

  • From 4.x to 5.x
    • Target frameworks support netstandard, .net6 and .net7
    • Minio upgraded to 5.0.0
  • From 3.x to 4.x
    • Minio upgraded to 4.0.0
    • options.OnClientConfiguration replaced with options.ConfigureClient(...)
  • From 5.x to 6.x
    • Minio upgraded to 6.0.1
    • DI client type changed from MinioClient to IMinioClient