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 9, 2024
1 parent 0d40dda commit 542fc21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 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
13 changes: 8 additions & 5 deletions Sources/ConfidenceProvider/Http/NetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 542fc21

Please sign in to comment.