Detect if iOS App is Downloaded from Apple's Testflight

How can I programmatically detect if the app was downloaded from Test Flight or from the Apple Store.

I need to set the URL to a test server if the app was downloaed from Test Flight and to a production server if downloaed from the Apple Store.


Thanks