Skip to content

Commit

Permalink
Issues boostcampwm-2022#287 feat: keystore.properties 에서 API KEY 를 관리…
Browse files Browse the repository at this point in the history
…하게 변경
  • Loading branch information
audxo112 committed Apr 9, 2023
1 parent 7b3cdcc commit 117366b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
*.iml
.gradle
/local.properties
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
keystore.properties
/.idea/
/buildSrc/build/
9 changes: 7 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@file:Suppress("UnstableApiUsage")

import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import java.io.FileInputStream
import java.util.Properties

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand All @@ -17,7 +18,11 @@ android {
versionCode = 1
versionName = "1.0.0"

val naverMapApiId = gradleLocalProperties(rootDir).getProperty("naver_map_api_id")
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
keystoreProperties.load(FileInputStream(keystorePropertiesFile))

val naverMapApiId = keystoreProperties.getProperty("naver_map_api_id")
manifestPlaceholders["naver_map_api_id"] = naverMapApiId
}

Expand Down
15 changes: 13 additions & 2 deletions data/data-remote/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
@file:Suppress("UnstableApiUsage")

import java.io.FileInputStream
import java.util.Properties

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand All @@ -10,8 +13,16 @@ plugins {
android {
namespace = "com.lighthouse.data.remote"

buildFeatures {
buildConfig = true
}

defaultConfig {
val kakaoSearchId = gradleLocalProperties(rootDir).getProperty("kakao_search_id")
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
keystoreProperties.load(FileInputStream(keystorePropertiesFile))

val kakaoSearchId = keystoreProperties.getProperty("kakao_search_id")
buildConfigField("String", "kakaoSearchId", kakaoSearchId)
}
}
Expand Down
8 changes: 8 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Feb 02 22:44:28 KST 2023
sdk.dir=C\:\\Users\\Home\\AppData\\Local\\Android\\Sdk

0 comments on commit 117366b

Please sign in to comment.