Skip to content

Instantly share code, notes, and snippets.

@gabrielbmoro
Created May 29, 2022 20:25
Show Gist options
  • Save gabrielbmoro/4c2d636cc15761d13513b24b115a7f1c to your computer and use it in GitHub Desktop.
Save gabrielbmoro/4c2d636cc15761d13513b24b115a7f1c to your computer and use it in GitHub Desktop.
Get Keystore properties from local environment or Bitrise
private static Properties loadProperties(Project rootProject) {
def keystoreProperties = new Properties()
// load your keystore.properties file into e keystoreProperties object.
try {
def keystorePropertiesFile = rootProject.file("keystore.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} catch(FileNotFoundException exception){
println(exception.message)
println("-------")
println("Trying to get the properties from environment variables")
println("-------")
keystoreProperties.put('securityKey', "$System.env.securityKey")
keystoreProperties.put('securityTransformation', "$System.env.securityTransformation")
keystoreProperties.put('securityAlgorithm', "$System.env.securityAlgorithm")
}
return keystoreProperties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment