Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

fastlane

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.

like image 583
Lutzifer Avatar asked May 05 '16 17:05

Lutzifer


People also ask

What should .env files contain?

The . env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your .

What does a .env file do?

A . env file or dotenv file is a simple text configuration file for controlling your Applications environment constants. Between Local, Staging and Production environments, the majority of your Application will not change.

Where can I find .env file?

env file is placed at the base of the project directory. Project directory can be explicitly defined with the --file option or COMPOSE_FILE environment variable.


1 Answers

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.

like image 129
KrauseFx Avatar answered Sep 28 '22 11:09

KrauseFx