Skip to content

Commit

Permalink
update sentry dsn
Browse files Browse the repository at this point in the history
  • Loading branch information
y-polek committed Jun 2, 2024
1 parent a51cf31 commit f8449e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# Docs:
# - GitHub Actions: https://help.github.com/en/actions
# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action
#
## JBIJPPTPL

name: Build
on: [push, pull_request]
Expand All @@ -37,7 +35,7 @@ jobs:
name: Test
needs: gradleValidation
env:
SENTRY_DNS: ${{ secrets.SENTRY_DNS }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
runs-on: ubuntu-latest
steps:

Expand Down Expand Up @@ -79,7 +77,7 @@ jobs:
name: Build
needs: test
env:
SENTRY_DNS: ${{ secrets.SENTRY_DNS }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
runs-on: ubuntu-latest
outputs:
name: ${{ steps.properties.outputs.name }}
Expand Down Expand Up @@ -153,8 +151,8 @@ jobs:
with:
plugin-location: plugin-artifact/${{ needs.build.outputs.artifact }}
ide-versions: |
ideaIC:2019.3
ideaIC:2020.1
ideaIC:2022.3
ideaIC:LATEST-EAP-SNAPSHOT
# Print the output of the verify step
- name: Print Logs
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ tasks {
writer.println("package dev.polek.adbwifi")
writer.println()

val sentryDns = System.getenv("SENTRY_DNS")
val sentryDnsStr = if (sentryDns != null) "\"$sentryDns\"" else "null"
writer.println("val SENTRY_DNS: String? = $sentryDnsStr")
val sentryDsn = System.getenv("SENTRY_DSN")
val sentryDsnStr = if (sentryDsn != null) "\"$sentryDsn\"" else "null"
writer.println("val SENTRY_DSN: String? = $sentryDsnStr")
}
}

Expand Down
14 changes: 6 additions & 8 deletions src/main/kotlin/dev/polek/adbwifi/report/ReportSubmitter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.intellij.openapi.progress.Task
import com.intellij.openapi.util.SystemInfo
import com.intellij.util.Consumer
import dev.polek.adbwifi.PluginBundle
import dev.polek.adbwifi.SENTRY_DNS
import dev.polek.adbwifi.SENTRY_DSN
import io.sentry.Sentry
import io.sentry.SentryEvent
import io.sentry.SentryOptions
Expand All @@ -23,10 +23,12 @@ import java.awt.Component

class ReportSubmitter : ErrorReportSubmitter() {

private val isSentryEnabled = SENTRY_DSN != null

init {
if (SENTRY_ENABLED) {
if (isSentryEnabled) {
Sentry.init { options: SentryOptions ->
options.dsn = SENTRY_DNS
options.dsn = SENTRY_DSN
options.isEnableUncaughtExceptionHandler = false
}
}
Expand All @@ -40,7 +42,7 @@ class ReportSubmitter : ErrorReportSubmitter() {
parentComponent: Component,
consumer: Consumer<in SubmittedReportInfo>
): Boolean {
if (!SENTRY_ENABLED) return false
if (!isSentryEnabled) return false

val context = DataManager.getInstance().getDataContext(parentComponent)
val project = CommonDataKeys.PROJECT.getData(context)
Expand Down Expand Up @@ -84,8 +86,4 @@ class ReportSubmitter : ErrorReportSubmitter() {
val ideaName = ApplicationInfo.getInstance().fullApplicationName
return "$os, $ideaName"
}

private companion object {
private val SENTRY_ENABLED = SENTRY_DNS != null
}
}

0 comments on commit f8449e0

Please sign in to comment.