-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
EndPoint - воспринимается скорее как url, и путает когда ему ставят в значения host (localhost)
Минусы
- breakchanges
Плюсы
- Компактней настройки (минус: port, schema)
- Ближе к настройкам Minio и Azure cloud
стало
public sealed class S3Settings
{
public required string AccessKey { get; init; }
public required string Bucket { get; init; }
// "http://{Hostname}:{Port)}
public required string Endpoint { get; init; }
public string Region { get; init; } = "us-east-1";
public required string SecretKey { get; init; }
public string Service { get; init; } = "s3";
public bool UseHttp2 { get; init; }
}c-tor S3Client фрагмент
// Клиента сделать обязательным и в тестах передавать из Fixture
public S3Client(HttpClient client, S3Settings settings, IArrayPool? arrayProvider = null)
{
Bucket = settings.Bucket ?? throw new ArgumentException(nameof(settings.Bucket));
var endpoint = new Uri(settings.Endpoint);
_bucket = $"{endpoint.AbsoluteUri}{Bucket.ToLowerInvariant()}";
_client = client;
_host = $"{endpoint.Host}:{endpoint.Port}";
_useHttp2 = settings.UseHttp2;
ArrayPool = arrayProvider ?? DefaultArrayPool.Instance;
_httpDescription = new HttpDescription(
ArrayPool,
settings.AccessKey,
settings.Region,
settings.Service,
S3Headers);
_signature = new Signature(_httpDescription, settings.SecretKey, settings.Region, settings.Service);
}Зы. Ну или может стоит переименовать Endpoint в Host? тут мои капризы и если чо - можно закрыть..
Metadata
Metadata
Assignees
Labels
No labels