Skip to content

Commit 9e8f83f

Browse files
authored
Add Support Secrets Gradle plugin (#2093)
* chore: Configured Secrets Gradle plugin * - Fixed Plugin Declaration - Removed optional secrets.properties file declaration - Configured And Applied Keys into default file * - Updated field declaration * - Updated field declaration
1 parent 27c4724 commit 9e8f83f

File tree

10 files changed

+62
-12
lines changed

10 files changed

+62
-12
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ mifosng-android/src/main/assets/crashlytics-build.properties
1010
android-client.iml
1111
mifosng-android/mifosng-android.iml
1212
*.hprof
13-
android-client.iml
13+
android-client.iml
14+
/secrets.properties

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ plugins {
66
alias(libs.plugins.hilt) apply false
77
alias(libs.plugins.kotlin.serialization) apply false
88
alias(libs.plugins.androidx.navigation) apply false
9+
alias(libs.plugins.secrets) apply false
910
}

core/common/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
alias(libs.plugins.android.library)
33
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.secrets)
45
}
56

67
android {
@@ -32,6 +33,14 @@ android {
3233
kotlinOptions {
3334
jvmTarget = "17"
3435
}
36+
37+
buildFeatures {
38+
buildConfig = true
39+
}
40+
}
41+
42+
secrets {
43+
defaultPropertiesFileName = "secrets.defaults.properties"
3544
}
3645

3746
dependencies {
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package com.mifos.core.common.utils
22

3+
import com.mifos.core.common.BuildConfig
4+
35
object BaseUrl {
46

7+
private val configs = BuildConfig.DEMO_SERVER_CONFIG.split(",")
8+
59
// "/" in the last of the base url always
610

7-
const val PROTOCOL_HTTPS = "https://"
11+
val PROTOCOL_HTTPS = configs[0]
812

9-
const val API_ENDPOINT = "demo.mifos.community"
13+
val API_ENDPOINT = configs[1]
1014

11-
const val API_PATH = "/fineract-provider/api/v1/"
15+
val API_PATH = configs[2]
1216

13-
const val PORT = "80"
17+
val PORT = configs[3]
1418

15-
const val TENANT = "default"
19+
val TENANT = configs[4]
1620
}

core/network/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
alias(libs.plugins.kotlin.android)
44
alias(libs.plugins.hilt)
55
alias(libs.plugins.kotlin.serialization)
6+
alias(libs.plugins.secrets)
67
id(libs.plugins.kotlin.parcelize.get().pluginId)
78
id(libs.plugins.kotlin.kapt.get().pluginId)
89
}
@@ -27,13 +28,23 @@ android {
2728
)
2829
}
2930
}
31+
3032
compileOptions {
3133
sourceCompatibility = JavaVersion.VERSION_17
3234
targetCompatibility = JavaVersion.VERSION_17
3335
}
36+
3437
kotlinOptions {
3538
jvmTarget = "17"
3639
}
40+
41+
buildFeatures {
42+
buildConfig = true
43+
}
44+
}
45+
46+
secrets {
47+
defaultPropertiesFileName = "secrets.defaults.properties"
3748
}
3849

3950
dependencies {

core/network/src/main/java/com/mifos/core/network/BaseUrl.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ package com.mifos.core.network
88
* @author fomenkoo
99
*/
1010
class BaseUrl {
11+
1112
// "/" in the last of the base url always
1213
companion object {
13-
const val PROTOCOL_HTTPS = "https://"
14-
const val API_ENDPOINT = "demo.mifos.community"
15-
const val API_PATH = "/fineract-provider/api/v1/"
16-
const val PORT = "80"
14+
private val configs = BuildConfig.DEMO_SERVER_CONFIG.split(",")
15+
16+
val PROTOCOL_HTTPS = configs[0]
17+
val API_ENDPOINT = configs[1]
18+
val API_PATH = configs[2]
19+
val PORT = configs[3]
1720
}
1821
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
19+
org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g
2020

2121
# When configured, Gradle will run in incubating parallel mode.
2222
# This option should only be used with decoupled projects. More details, visit

mifosng-android/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ plugins {
1111
alias(libs.plugins.kotlin.android)
1212
alias(libs.plugins.kotlin.serialization)
1313
alias(libs.plugins.hilt)
14+
alias(libs.plugins.secrets)
1415
id(libs.plugins.kotlin.parcelize.get().pluginId)
1516
id(libs.plugins.kotlin.kapt.get().pluginId)
1617
}
@@ -118,6 +119,10 @@ android {
118119
}
119120
}
120121

122+
secrets {
123+
defaultPropertiesFileName = "secrets.defaults.properties"
124+
}
125+
121126
dependencies {
122127

123128
implementation(project(":feature:auth"))

mifosng-android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<meta-data
3030
android:name="com.google.android.geo.API_KEY"
31-
android:value="@string/google_maps_key" />
31+
android:value="${GEO_API_KEY}" />
3232

3333
<activity
3434
android:name=".activity.splashscreen.SplashScreenActivity"

secrets.defaults.properties

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
## Update DEMO_SERVER_CONFIG according below mentioned your server config
3+
4+
# PROTOCOL_HTTPS=https://
5+
# API_ENDPOINT=demo.mifos.community
6+
# API_PATH=/fineract-provider/api/v1/
7+
# PORT=80
8+
# TENANT=default
9+
10+
# Separated By Comma (,) Without Space like below
11+
# PROTOCOL_HTTPS,API_ENDPOINT,API_PATH,PORT,TENANT
12+
13+
DEMO_SERVER_CONFIG="https://,demo.mifos.community,/fineract-provider/api/v1/,80,default"
14+
15+
# Provide GEO API Key
16+
GEO_API_KEY=AIzaSyAZTZqvDGyyw21z2Ee7N-dE_WuZQwKL0

0 commit comments

Comments
 (0)