WLBORg WLBORg - 5 months ago 67x
iOS Question

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

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:

Use an Appfile like this:

apple_id ENV["APPLE_ID"] || "default@company.com"
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 (default@company.com)

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.