Skip to content

Commit 695f33a

Browse files
astanslermakrusak
authored andcommitted
feat: build configs (#44)
* feat: build configs * chore: remove logging
1 parent 6aefc82 commit 695f33a

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ plugins {
1717
id 'de.fuerstenau.buildconfig' version '1.1.8'
1818
}
1919

20+
21+
2022
apply plugin: "idea"
2123
apply plugin: "java"
2224
apply plugin: "kotlin"
@@ -25,16 +27,33 @@ apply plugin: "com.google.protobuf"
2527
apply plugin: "org.junit.platform.gradle.plugin"
2628

2729
buildConfig {
30+
ext.environment = project.hasProperty('env') &&
31+
env == 'production' ? 'prod' : 'dev'
32+
2833
clsName = 'BuildConfig'
2934
packageName = 'app'
35+
36+
// API.
37+
def apiBasePath = 'https://staging.eng.sourcerer.io/api/commit'
38+
if (ext.environment == 'prod') {
39+
apiBasePath = 'https://sourcerer.io/api/commit'
40+
}
41+
apiBasePath = project.hasProperty('api') ? api : apiBasePath
42+
43+
buildConfigField 'String', 'API_BASE_PATH', apiBasePath
44+
45+
// Common.
46+
buildConfigField 'String', 'PROFILE_URL', 'https://sourcerer.io/'
47+
48+
// App version.
3049
buildConfigField 'int', 'VERSION_CODE', '1'
3150
buildConfigField 'String', 'VERSION', '0.0.1'
32-
buildConfigField 'String', 'PROFILE_URL', 'https://sourcerer.io/'
33-
buildConfigField 'String', 'API_BASE_URL',
34-
'https://staging.eng.sourcerer.io/api/commit'
51+
52+
// Google Analytics.
3553
buildConfigField 'String', 'GA_BASE_PATH', 'http://www.google-analytics.com'
3654
buildConfigField 'String', 'GA_TRACKING_ID', 'UA-107129190-2'
3755
buildConfigField 'boolean', 'IS_GA_ENABLED', 'true'
56+
3857
buildConfig
3958
}
4059

src/main/kotlin/app/api/ServerApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ServerApi (private val configurator: Configurator) : Api {
5151
}
5252

5353
init {
54-
fuelManager.basePath = BuildConfig.API_BASE_URL
54+
fuelManager.basePath = BuildConfig.API_BASE_PATH
5555
fuelManager.addRequestInterceptor { cookieRequestInterceptor() }
5656
fuelManager.addResponseInterceptor { cookieResponseInterceptor() }
5757
}

0 commit comments

Comments
 (0)