We have the need to override values in fastlane's appfile in certain situations, e.g. to use a different apple account for publication of the app, but there is no documented official way.
The easiest way to do that is using environment variables:
Appfile like this:
apple_id ENV["APPLE_ID"] || "email@example.com" app_identifier ENV["APP_IDENTIFIER"] || "com.company.default"
When you now call fastlane without environment variables:
it will use the default values provided (
to set a different value you can use
APP_IDENTIFIER="com.custom.app" fastlane enterprise
Also as already pointed out by other replies, you can always have multiple lanes for different environments and just pass a different app identifier or username to each of the actions you're calling.