How to override values inside fastlane's appfile using .env files

Lutzifer picture Lutzifer · May 5, 2016 · Viewed 7.1k times · Source

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.

Answer

KrauseFx picture KrauseFx · May 19, 2016

The easiest way to do that is using environment variables:

Use an Appfile like this:

apple_id ENV["APPLE_ID"] || "[email protected]"
app_identifier ENV["APP_IDENTIFIER"] || "com.company.default"

When you now call fastlane without environment variables:

fastlane beta

it will use the default values provided ([email protected])

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.