New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set koala's base url based on current environment #820
Conversation
case .production: | ||
return Secrets.KoalaEndpoint.production | ||
} | ||
fileprivate var base: String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since our base url
is being affected by environmentType
we no longer require a separate Endpoint
enum.
fileprivate var base: String { | ||
switch AppEnvironment.current.environmentType { | ||
case .production: | ||
return Secrets.KoalaEndpoint.production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only production
will go to production
... anything else (development
or local
) should default to staging
@@ -130,7 +123,7 @@ public final class KoalaTrackingClient: TrackingClientType { | |||
if dataString.count >= 10_000 { | |||
print("π¨ [Koala Error]: Base64 payload is longer than 10,000 characters.") | |||
} | |||
return URL(string: "\(self.endpoint.base)?data=\(dataString)") | |||
return URL(string: "\(self.base)?data=\(dataString)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately KoalaClient
isn't very testable (most if not all functions are fileprivate
) so I'd suggest we proceed without tests for now (as I wasn't able to figure out how to test)...open to any suggestions!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All scenarios worked. (The Release AC was tested on build 15670112). π
π² What
Tracking events are send to the right Koala endpoint based on current environment.
π€ Why
We ran into an issue where all tracking events were being sent to production environment. We would like to set the Koala endpoint based on current environment.
π How
See the code change
β Acceptance criteria
Release build
Charlesproxy
ormitmproxy
(there are instructions in Guru how to do this)Release
mode by following these instructionsproduction
endpoint (this value is accessible inSecrets.KoalaEndpoint.production
Environment
Debug build (Alpha, Beta, Debug)
Charlesproxy
ormitmproxy
(there are instructions in Guru how to do this)Debug
modeKOALA_TRACKING
environment variable is turnedON
by following these instructionsEnvironment
toStaging
(in Beta tools) tracking events are being sent tostaging
endpoint (this value is accessible inSecrets.KkoalaEndpoint.staging
)Environment
toProduction
(in Beta tools) tracking events are being sent toproduction
endpoint (this value is accessible inSecrets.KkoalaEndpoint.production
)Environment
Please note that if you're immediately not seeing any events you can background the app which should flush the queue.