container registry login host:port error fix (#170)

Fixes #121

Gets port from the given registry server URL and use it in a
RegistryClient.

Signed-off-by: Alexey Makhov <makhov.alex@gmail.com>
This commit is contained in:
Alexey Makhov
2025-06-13 17:33:05 +03:00
committed by GitHub
parent 206f3cc07c
commit 2a12f01d32
+9 -1
View File
@@ -63,10 +63,18 @@ extension Application {
let server = Reference.resolveDomain(domain: server)
let scheme = try RequestScheme(registry.scheme).schemeFor(host: server)
let _url = "\(scheme)://\(server)"
guard let url = URL(string: _url) else {
throw ContainerizationError(.invalidArgument, message: "Cannot convert \(_url) to URL")
}
guard let host = url.host else {
throw ContainerizationError(.invalidArgument, message: "Invalid host \(server)")
}
let client = RegistryClient(
host: server,
host: host,
scheme: scheme.rawValue,
port: url.port,
authentication: BasicAuthentication(username: username, password: password),
retryOptions: .init(
maxRetries: 10,