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..9928ac4a 100644 --- a/Sources/ConfidenceProvider/Http/NetworkClient.swift +++ b/Sources/ConfidenceProvider/Http/NetworkClient.swift @@ -8,11 +8,14 @@ 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/v1/flags" + case .europe: + return "https://resolver.eu.confidence.dev/v1/flags" + case .usa: + return "https://resolver.us.confidence.dev/v1/flags" + } } init( diff --git a/Tests/ConfidenceProviderTests/ConfidenceIntegrationTest.swift b/Tests/ConfidenceProviderTests/ConfidenceIntegrationTest.swift index 812f2810..9530afd7 100644 --- a/Tests/ConfidenceProviderTests/ConfidenceIntegrationTest.swift +++ b/Tests/ConfidenceProviderTests/ConfidenceIntegrationTest.swift @@ -5,7 +5,7 @@ import XCTest @testable import ConfidenceProvider class ConfidenceIntegrationTests: XCTestCase { - let clientToken: String? = ProcessInfo.processInfo.environment["CLIENT_TOKEN"] + let clientToken: String? = "5GdaBq79NMVrMGXRVhN9g1pBKtG9cNK8" let resolveFlag = setResolveFlag() let storage: Storage = StorageMock()