diff --git a/Sources/ConfidenceProvider/ConfidenceClient/RemoteConfidenceClient.swift b/Sources/ConfidenceProvider/ConfidenceClient/RemoteConfidenceClient.swift index 35bdd4f0..05441db8 100644 --- a/Sources/ConfidenceProvider/ConfidenceClient/RemoteConfidenceClient.swift +++ b/Sources/ConfidenceProvider/ConfidenceClient/RemoteConfidenceClient.swift @@ -171,7 +171,7 @@ public struct ConfidenceClientOptions { ) { self.credentials = credentials self.timeout = timeout ?? 10.0 - self.region = region ?? .europe + self.region = region ?? .global } } @@ -187,6 +187,7 @@ public enum ConfidenceClientCredentials { } public enum ConfidenceRegion: String { + case global = "global" case europe = "eu" case usa = "us" } diff --git a/Sources/ConfidenceProvider/Http/NetworkClient.swift b/Sources/ConfidenceProvider/Http/NetworkClient.swift index c6feaf90..872b2ac7 100644 --- a/Sources/ConfidenceProvider/Http/NetworkClient.swift +++ b/Sources/ConfidenceProvider/Http/NetworkClient.swift @@ -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(