Skip to content

Commit 06c5298

Browse files
committed
fix: class cast ex
1 parent c45fac7 commit 06c5298

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

boot/src/main/kotlin/spp/probe/SourceProbe.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ object SourceProbe {
174174
val options = NetClientOptions()
175175
.setReconnectAttempts(Int.MAX_VALUE).setReconnectInterval(5000)
176176
.setSsl(ProbeConfiguration.sslEnabled)
177-
.setTrustAll(!ProbeConfiguration.spp.getBoolean("verify_host", true))
177+
.setTrustAll(!ProbeConfiguration.spp.getValue("verify_host", true).toString().toBooleanStrict())
178178
.apply {
179179
if (ProbeConfiguration.getString("platform_certificate") != null) {
180180
val myCaAsABuffer = Buffer.buffer(
@@ -303,10 +303,9 @@ object SourceProbe {
303303
}
304304

305305
private fun unzipAgent(skywalkingVersion: String) {
306-
val deleteProbeDirOnBoot = ProbeConfiguration.spp.getBoolean(
307-
"delete_probe_directory_on_boot",
308-
System.getenv("SPP_DELETE_PROBE_DIRECTORY_ON_BOOT")?.lowercase()?.toBooleanStrictOrNull()
309-
) ?: true
306+
val deleteProbeDirOnBoot = ProbeConfiguration.spp.getValue(
307+
"delete_probe_directory_on_boot", true
308+
).toString().toBooleanStrict()
310309
if (deleteProbeDirOnBoot) {
311310
deleteRecursively(PROBE_DIRECTORY)
312311
}

common/src/test/kotlin/spp/probe/ProbeConfigurationTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ class ProbeConfigurationTest {
3636

3737
ProbeConfiguration.localProperties = config
3838
assertEquals(false, ProbeConfiguration.sslEnabled)
39+
assertEquals(true, ProbeConfiguration.spp.getValue("verify_host").toString().toBooleanStrict())
40+
assertEquals(
41+
false,
42+
ProbeConfiguration.spp.getValue("delete_probe_directory_on_boot").toString().toBooleanStrict()
43+
)
3944

4045
val swSettings = ProbeConfiguration.toSkyWalkingSettings(config)
4146
assertEquals("INFO", swSettings.find {

common/src/test/resources/spp-probe-env.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ spp:
22
platform_host: ${SPP_PROBE_PLATFORM_HOST:-127.0.0.1}
33
platform_port: ${SPP_PROBE_PLATFORM_PORT:-1234}
44
ssl_enabled: ${SPP_PROBE_SSL_ENABLED:-false}
5+
verify_host: ${SPP_PROBE_VERIFY_HOST:-true}
6+
delete_probe_directory_on_boot: ${SPP_PROBE_DELETE_PROBE_DIRECTORY_ON_BOOT:-false}
57
skywalking:
68
logging:
79
level: ${SW_LOGGING_LEVEL:-INFO}

0 commit comments

Comments
 (0)