Skip to content

Commit 5e86151

Browse files
fix(clients): correly parse usage hosts (generated)
algolia/api-clients-automation#3622 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 662ed75 commit 5e86151

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

Sources/Monitoring/MonitoringClientConfiguration.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@ public struct MonitoringClientConfiguration: BaseConfiguration, Credentials {
4848
UserAgentController.append(UserAgent(title: "Monitoring", version: Version.current.description))
4949

5050
guard let hosts else {
51-
guard let url = URL(string: "https://status.algolia.com") else {
52-
throw AlgoliaError.runtimeError("Malformed URL")
53-
}
54-
5551
self.hosts = [
56-
.init(url: url),
52+
.init(url: URL(string: "https://status.algolia.com")!),
5753
]
5854
return
5955
}

Sources/Usage/UsageClientConfiguration.swift

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,10 @@ public struct UsageClientConfiguration: BaseConfiguration, Credentials {
4848
UserAgentController.append(UserAgent(title: "Usage", version: Version.current.description))
4949

5050
guard let hosts else {
51-
func buildHost(_ components: (suffix: String, callType: RetryableHost.CallTypeSupport)) throws
52-
-> RetryableHost {
53-
guard let url = URL(string: "https://\(appID)\(components.suffix)") else {
54-
throw AlgoliaError.runtimeError("Malformed URL")
55-
}
56-
57-
return RetryableHost(url: url, callType: components.callType)
58-
}
59-
60-
let hosts = try [
61-
("-dsn.algolia.net", .read),
62-
(".algolia.net", .write),
63-
].map(buildHost)
64-
65-
let commonHosts = try [
66-
("-1.algolianet.com", .universal),
67-
("-2.algolianet.com", .universal),
68-
("-3.algolianet.com", .universal),
69-
].map(buildHost).shuffled()
70-
71-
self.hosts = hosts + commonHosts
72-
51+
self.hosts = [
52+
.init(url: URL(string: "https://usage.algolia.com")!),
53+
.init(url: URL(string: "https://usage-dev.algolia.com")!),
54+
]
7355
return
7456
}
7557

0 commit comments

Comments
 (0)