Suppose I have a mobile app that uses an API at api.myapp.com
. I want to be able to test the app on my personal dev machine mymac.local
and also on a production-standard test server test.myapp.com
.
What's the best way to allow a production mobile app to switch to an alternative API endpoint?
Options I've thought of with the cons I've thought of:
Put an Easter egg somewhere in the app that only devs know about. e.g. tap 5 times on the logo and an API endpoint input box pops up.
Cons: Easter eggs get discovered.
Put a settings option in the normal settings menu (I think Twitter used to do this).
Cons: Looks amateur?
Create an URL schema like
myapp://change_api?endpoint=api.mysite.com
Cons: This is a bit of a pain to use.
Are there other, better ways to do this that I haven't thought of?