Skip to content

Commit

Permalink
chore: added eventsApiProxyURL option for proxying to a different url…
Browse files Browse the repository at this point in the history
… than the sdk config
  • Loading branch information
jsalaber committed Apr 9, 2024
1 parent 7402bbf commit a94b66c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions DevCycle/Models/DevCycleOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion DevCycle/Networking/DevCycleService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a94b66c

Please sign in to comment.