diff --git a/DevCycle/Models/DevCycleOptions.swift b/DevCycle/Models/DevCycleOptions.swift index 6b1ef7c..0d1f80a 100644 --- a/DevCycle/Models/DevCycleOptions.swift +++ b/DevCycle/Models/DevCycleOptions.swift @@ -16,6 +16,7 @@ public class DevCycleOptions { var disableAutomaticEventLogging: Bool = false var disableCustomEventLogging: Bool = false var apiProxyURL: String? + var eventsApiProxyURL: String? public class OptionsBuilder { var options: DevCycleOptions @@ -90,6 +91,12 @@ public class DevCycleOptions { return self } + // Allows the SDK to use a proxy to send to for the events API + public func eventsApiProxyURL(_ proxyURL: String) -> OptionsBuilder { + self.options.eventsApiProxyURL = proxyURL + return self + } + public func build() -> DevCycleOptions { let result = self.options self.options = DevCycleOptions() diff --git a/DevCycle/Networking/DevCycleService.swift b/DevCycle/Networking/DevCycleService.swift index 04d57c7..03c90be 100644 --- a/DevCycle/Networking/DevCycleService.swift +++ b/DevCycle/Networking/DevCycleService.swift @@ -245,7 +245,7 @@ class DevCycleService: DevCycleServiceProtocol { switch(type) { case "event": - if let proxyUrl = self.options?.apiProxyURL { + if let proxyUrl = self.options?.eventsApiProxyURL { url = proxyUrl } else { url = NetworkingConstants.eventsUrl + NetworkingConstants.hostUrl