2

I have an android project using KotlinDSL.

I create APK and submit it to AppCenter and Play Store. At the moment, I am putting some keys and passwords for these environments in Fastfile as follows.

lane :build_test_app do
       gradle(
             task: "assemble",
             build_type: "Release",
             flavor: "Dev",
             print_command: false,
             properties: {
                 "android.injected.signing.store.file" => "/Users/user/Desktop/appjks",
                 "android.injected.signing.store.password" => "asd123,
                 "android.injected.signing.key.alias" => "asd123456",
                 "android.injected.signing.key.password" => "asd1234",
             }
         )
    end

-> Or as below to build apk

private_lane :upload_apk_to_appcenter do
        appcenter_upload(
               api_token: "0123.....",             
               owner_name: "MyCompany",
               owner_type: "user",
               app_os: 'Android',
               app_platform: 'Java',
               app_name: "MyApp",
               file: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
            
        )
    end

-> Slack url as below

before_all do  
    ENV["SLACK_URL"] = "https://hooks.slack.com/services/123asd......."
end

I think all these passwords should not be in this file. I want to read these from a file that won't be added to git. For example local.properties.

How can I do this or how can I do it best?

enjektor0
  • 483
  • 2
  • 8

1 Answers1

1

You can use File.read() for a local file. Create a password.txt file in your project folder along with a .gitignore. You can read the password from there like this:

puts(password: File.read("../password.txt"))
Staxlinou
  • 1,351
  • 1
  • 5
  • 20
Akif
  • 7,098
  • 7
  • 27
  • 53