Skip to content

Commit

Permalink
- Updated field declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
niyajali committed May 9, 2024
1 parent 5624b7a commit bc221fd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
12 changes: 7 additions & 5 deletions core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import com.mifos.core.common.BuildConfig

object BaseUrl {

private val configs = BuildConfig.DEMO_SERVER_CONFIG.split(",")

// "/" in the last of the base url always

const val PROTOCOL_HTTPS = BuildConfig.PROTOCOL_HTTPS
val PROTOCOL_HTTPS = configs[0]

const val API_ENDPOINT = BuildConfig.API_ENDPOINT
val API_ENDPOINT = configs[1]

const val API_PATH = BuildConfig.API_PATH
val API_PATH = configs[2]

const val PORT = BuildConfig.PORT
val PORT = configs[3]

const val TENANT = BuildConfig.TENANT
val TENANT = configs[4]
}
10 changes: 10 additions & 0 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ plugins {
id(libs.plugins.kotlin.kapt.get().pluginId)
}

val protocol = project.properties["PROTOCOL_HTTPS"].toString()
val apiEndpoint = project.properties["API_ENDPOINT"].toString()
val apiPath = project.properties["API_PATH"].toString()
val port = project.properties["PORT"].toString()
val tenant = project.properties["TENANT"].toString()

val serverConfig = "$protocol,$apiEndpoint,$apiPath,$port,$tenant"

android {
namespace = "com.mifos.core.network"
compileSdk = 34
Expand All @@ -17,6 +25,8 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")

buildConfigField("String", "SERVER_CONFIG", "\"$serverConfig\"")
}

buildTypes {
Expand Down
11 changes: 7 additions & 4 deletions core/network/src/main/java/com/mifos/core/network/BaseUrl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ package com.mifos.core.network
* @author fomenkoo
*/
class BaseUrl {

// "/" in the last of the base url always
companion object {
const val PROTOCOL_HTTPS = BuildConfig.PROTOCOL_HTTPS
const val API_ENDPOINT = BuildConfig.API_ENDPOINT
const val API_PATH = BuildConfig.API_PATH
const val PORT = BuildConfig.PORT
private val configs = BuildConfig.SERVER_CONFIG.split(",")

val PROTOCOL_HTTPS = configs[0]
val API_ENDPOINT = configs[1]
val API_PATH = configs[2]
val PORT = configs[3]
}
}
16 changes: 15 additions & 1 deletion secrets.defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ PORT = 80
TENANT = default

# Provide GEO API Key
GEO_API_KEY = AIzaSyAZTZqvDGyyw21z2Ee7N-dE_WuZQwKL0bs
GEO_API_KEY = AIzaSyAZTZqvDGyyw21z2Ee7N-dE_WuZQwKL0bs

DEMO_SERVER_CONFIG = "https://,demo.mifos.community,/fineract-provider/api/v1/,80,default"

#SERVER_CONFIG = "${PROTOCOL_HTTPS}"
#
#SERVER_CONFIGs = '${PROTOCOL_HTTPS}'
#
#SERVER_CONFIGt = '\PROTOCOL_HTTPS\'
#
#SERVER_CONFIGD = \${PROTOCOL_HTTPS}
#
#SERVER_CONFIGe = $PROTOCOL_HTTPS

#SERVER_CONFIGf = "\"{$PROTOCOL_HTTPS}\""

0 comments on commit bc221fd

Please sign in to comment.