Skip to content

Commit d612983

Browse files
committed
Getting port from the given registry server URL and use it in a client
Signed-off-by: Alexey Makhov <makhov.alex@gmail.com>
1 parent 3838be5 commit d612983

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/CLI/Registry/Login.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,18 @@ extension Application {
6363

6464
let server = Reference.resolveDomain(domain: server)
6565
let scheme = try RequestScheme(registry.scheme).schemeFor(host: server)
66+
let _url = "\(scheme)://\(server)"
67+
guard let url = URL(string: _url) else {
68+
throw ContainerizationError(.invalidArgument, message: "Cannot convert \(_url) to URL")
69+
}
70+
guard let host = url.host else {
71+
throw ContainerizationError(.invalidArgument, message: "Invalid host \(server)")
72+
}
6673

6774
let client = RegistryClient(
68-
host: server,
75+
host: host,
6976
scheme: scheme.rawValue,
77+
port: url.port,
7078
authentication: BasicAuthentication(username: username, password: password),
7179
retryOptions: .init(
7280
maxRetries: 10,

0 commit comments

Comments
 (0)