Skip to content

Commit

Permalink
add GLOBAL as default provider endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nickybondarenko committed Jan 8, 2024
1 parent 0d40dda commit c9a5530
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public struct ConfidenceClientOptions {
) {
self.credentials = credentials
self.timeout = timeout ?? 10.0
self.region = region ?? .europe
self.region = region ?? .global
}
}

Expand All @@ -187,6 +187,7 @@ public enum ConfidenceClientCredentials {
}

public enum ConfidenceRegion: String {
case global = "global"
case europe = "eu"
case usa = "us"
}
Expand Down
14 changes: 9 additions & 5 deletions Sources/ConfidenceProvider/Http/NetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ final class NetworkClient: HttpClient {
private let region: ConfidenceRegion

private var baseUrl: String {
let region = region.rawValue
let domain = "confidence.dev"
let resolveRoute = "/v1/flags"

return "https://resolver.\(region).\(domain)\(resolveRoute)"
switch region {
case .global:
return "https://resolver.confidence.dev"
case .europe, .usa:
let region = region.rawValue
let domain = "confidence.dev"
let resolveRoute = "/v1/flags"
return "https://resolver.\(region).\(domain)\(resolveRoute)"
}
}

init(
Expand Down

0 comments on commit c9a5530

Please sign in to comment.