Skip to content

Instantly share code, notes, and snippets.

@joshdholtz
Last active July 10, 2025 15:46
Show Gist options
  • Save joshdholtz/cd077ccdddb608af00eb2466259e7ac0 to your computer and use it in GitHub Desktop.
Save joshdholtz/cd077ccdddb608af00eb2466259e7ac0 to your computer and use it in GitHub Desktop.

Revisions

  1. Josh Holtz renamed this gist Aug 3, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Josh Holtz revised this gist Aug 3, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Fastfile_before_all
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    fastlane_require 'dotenv'

    before_all do
    Dotenv.overload '.env.secret'
    end
  3. Josh Holtz created this gist Aug 3, 2017.
    1 change: 1 addition & 0 deletions .env
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    STUFF = this is some stuff
    1 change: 1 addition & 0 deletions .env.config1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    CONFIG = this is config 1
    1 change: 1 addition & 0 deletions .env.config2
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    CONFIG = this is config 2
    1 change: 1 addition & 0 deletions .env.secret
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    SOME_API_TOKEN = 123456789
    1 change: 1 addition & 0 deletions .gitignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    .env.secret
    17 changes: 17 additions & 0 deletions Fastfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    fastlane_require 'dotenv'

    before_all do
    Dotenv.overload '.env.secret'
    end

    lane :test do
    # Loaded from .env (by fastlane)
    puts "STUFF: #{ENV['STUFF']}"

    # Loaded from .env.secret (by us in before_all)
    puts "SOME_API_TOKEN: #{ENV['SOME_API_TOKEN']}"

    # Loaded from .env.(<env>) where <env> is passed in from `fastlane test --env <env>` (by fastlane)
    # Ex: `fastlane test --env config` loads .env.config1
    puts "CONFIG: #{ENV['CONFIG']}"
    end
    14 changes: 14 additions & 0 deletions output.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    $: fastlane test
    STUFF: this is some stuff
    SOME_API_TOKEN: 123456789
    CONFIG:

    $: fastlane test --env config1
    STUFF: this is some stuff
    SOME_API_TOKEN: 123456789
    CONFIG: this is config 1

    $: fastlane test --env config2
    STUFF: this is some stuff
    SOME_API_TOKEN: 123456789
    CONFIG: this is config 2