how to target staging environment from app store build

im launching my first app and was looking for how to make my testflight build point to a stagining api, but the ENV comes back as production. is there another variable to know if my app is running as test flight or live? or do i need to a make specific build with api url for test flight as stage? This is critical to match the api endpoint with the sandbox url in appstore connect