Skip to content

Commit

Permalink
fix: sentry dsn is now injected via build vars
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianEstrada committed Sep 8, 2024
1 parent 02c555a commit c389894
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ jobs:
java-version: '17'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3
- name: Setup Sentry
shell: bash
run: |
find . -name logback.xml -exec sed -i 's/\${SENTRY_DSN}/${{ secrets.SENTRY_DSN }}/g' {} \;
echo "Modified logback.xml:"
find . -name logback.xml -exec cat {} \;
- name: Build
env:
GHL_USERNAME: ${{ secrets.GHL_USERNAME }}
GHL_PASSWORD: ${{ secrets.GHL_PASSWORD }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: ./gradlew --no-daemon v16:packageDistributionForCurrentOS
- name: Upload binary file to release
uses: svenstaro/upload-release-action@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ class AnalyticsHelper(
}

fun initSentry() {
val sentryDsn: String? = System.getProperty("sentry.dsn")
if (sentryDsn.isNullOrEmpty()) {
logger.warn("sentry.dsn is not set")
return
}
try {
Sentry.init { options ->
options.dsn = sentryDsn
}
Sentry.setUser(
User().apply {
id = appUserService.getUserId()
Expand Down
5 changes: 5 additions & 0 deletions v16/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ compose.desktop {
packageName = "OcppEmulator"
packageVersion = "$version"

// JVM arguments, pass build-time properties here
jvmArgs += listOf(
"-Dsentry.dsn=${System.getenv("SENTRY_DSN") ?: null}"
)

macOS {
iconFile.set(project.file("src/jvmMain/resources/icon.icns"))
bundleID = "com.monta.ocpp.emulator.v16"
Expand Down
2 changes: 1 addition & 1 deletion v16/src/jvmMain/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<options>
<environment>production</environment>
<release>${jpackage.app-version}</release>
<dsn>${SENTRY_DSN}</dsn>
<dsn>${sentry.dsn}</dsn>
</options>
<!-- Optionally change minimum Event level. Default for Events is ERROR -->
<minimumEventLevel>ERROR</minimumEventLevel>
Expand Down

0 comments on commit c389894

Please sign in to comment.