From 9cd478386fbbfbc2b7fb300422af4cb39e14d01e Mon Sep 17 00:00:00 2001 From: "Davin Byeon (Dan)" Date: Wed, 8 Mar 2023 00:06:07 +0900 Subject: [PATCH] minor improves (#3) --- build.gradle.kts | 2 +- truffle-core/src/main/kotlin/TruffleClient.kt | 2 ++ .../src/main/kotlin/protocol/TruffleApp.kt | 2 +- .../src/main/kotlin/TruffleProperties.kt | 16 ++++++++++++++++ ....boot.autoconfigure.AutoConfiguration.imports | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 truffle-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/build.gradle.kts b/build.gradle.kts index 645ffe3..01cbda3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ import java.io.FileOutputStream import java.util.Properties plugins { - id("org.springframework.boot") version "3.0.1" apply false + id("org.springframework.boot") version "3.0.3" apply false id("io.spring.dependency-management") version "1.1.0" kotlin("jvm") version "1.8.0" kotlin("plugin.spring") version "1.8.0" diff --git a/truffle-core/src/main/kotlin/TruffleClient.kt b/truffle-core/src/main/kotlin/TruffleClient.kt index c06f799..6570df2 100644 --- a/truffle-core/src/main/kotlin/TruffleClient.kt +++ b/truffle-core/src/main/kotlin/TruffleClient.kt @@ -59,6 +59,8 @@ class DefaultTruffleClient( } override fun sendEvent(ex: Throwable) { + if (truffleApp.phase == "local" || truffleApp.phase == "test") return + events.tryEmit( TruffleEvent( app = truffleApp, diff --git a/truffle-core/src/main/kotlin/protocol/TruffleApp.kt b/truffle-core/src/main/kotlin/protocol/TruffleApp.kt index e1e1a92..0c92c56 100644 --- a/truffle-core/src/main/kotlin/protocol/TruffleApp.kt +++ b/truffle-core/src/main/kotlin/protocol/TruffleApp.kt @@ -2,5 +2,5 @@ package com.wafflestudio.truffle.sdk.core.protocol data class TruffleApp( val name: String, - val phase: String? = null, + val phase: String, ) diff --git a/truffle-spring-boot-starter/src/main/kotlin/TruffleProperties.kt b/truffle-spring-boot-starter/src/main/kotlin/TruffleProperties.kt index 0575b80..f1569aa 100644 --- a/truffle-spring-boot-starter/src/main/kotlin/TruffleProperties.kt +++ b/truffle-spring-boot-starter/src/main/kotlin/TruffleProperties.kt @@ -4,7 +4,23 @@ import org.springframework.boot.context.properties.ConfigurationProperties @ConfigurationProperties("truffle.client") data class TruffleProperties( + /** + * Truffle 이 식별하는 애플리케이션의 이름. + * + * 에러 리포트에 사용되며 Truffle 서버에 등록된 이름과 일치하는 정확한 애플리케이션 이름이 사용되어야 합니다. + */ val name: String, + /** + * 애플리케이션의 환경을 구분하는 이름. + * + * 에러 리포트에 사용되며 `"prod"`, `"dev"`, `"local"` 등이 사용될 수 있습니다. + * `"local"` 또는 `"test"`가 사용되는 경우, Truffle SDK 는 Truffle 서버로 요청을 전송하지 않습니다. + */ val phase: String, + /** + * Truffle 서버에서 애플리케이션의 요청이 유효한지 검증하는 데에 사용하는 API key. + * + * 외부에 공개되지 않도록 주의해 관리해야 합니다. + */ val apiKey: String, ) diff --git a/truffle-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/truffle-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..b00437d --- /dev/null +++ b/truffle-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.wafflestudio.truffle.sdk.TruffleAutoConfiguration