Created
May 29, 2022 20:25
-
-
Save gabrielbmoro/4c2d636cc15761d13513b24b115a7f1c to your computer and use it in GitHub Desktop.
Get Keystore properties from local environment or Bitrise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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