From bbc5b79074d9151780a2af9554a8a869c761e5a3 Mon Sep 17 00:00:00 2001
From: Hee Tatt Ooi <hee.tatt.ooi@sap.com>
Date: Wed, 10 Jun 2020 09:54:00 +0200
Subject: [PATCH] reintroduced url override from local.properties (#331)

---
 Corona-Warn-App/build.gradle | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/Corona-Warn-App/build.gradle b/Corona-Warn-App/build.gradle
index d0f7db7aa..8adb21205 100644
--- a/Corona-Warn-App/build.gradle
+++ b/Corona-Warn-App/build.gradle
@@ -41,6 +41,28 @@ android {
         buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\""
         buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp-dev\""
 
+        //override URLs with local variables
+        Properties properties = new Properties()
+        def propertiesFile = project.rootProject.file('local.properties')
+        if (propertiesFile.exists()) {
+            properties.load(propertiesFile.newDataInputStream())
+            def secretFile = project.rootProject.file('secrets.properties')
+            if (secretFile.exists())
+                properties.load(secretFile.newDataInputStream())
+
+            def DOWNLOAD_CDN_URL = properties.getProperty('DOWNLOAD_CDN_URL')
+            if (DOWNLOAD_CDN_URL)
+                buildConfigField "String", "DOWNLOAD_CDN_URL", "\"$DOWNLOAD_CDN_URL\""
+
+            def SUBMISSION_CDN_URL = properties.getProperty('SUBMISSION_CDN_URL')
+            if (SUBMISSION_CDN_URL)
+                buildConfigField "String", "SUBMISSION_CDN_URL", "\"$SUBMISSION_CDN_URL\""
+
+            def VERIFICATION_CDN_URL = properties.getProperty('VERIFICATION_CDN_URL')
+            if (VERIFICATION_CDN_URL)
+                buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\""
+        }
+
         javaCompileOptions {
             annotationProcessorOptions {
                 arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
-- 
GitLab