From 8702e29171f86a3975adcd904fed2693a606f5bd Mon Sep 17 00:00:00 2001 From: Antoine Jaury Date: Wed, 8 Jul 2026 16:57:14 +0200 Subject: [PATCH] enhance: read Sentry DSN from local.properties to support private configuration --- androidApp/build.gradle.kts | 14 ++++++++++++++ androidApp/src/main/AndroidManifest.xml | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index ad81c65..a4550b8 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,4 +1,5 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import java.util.Properties plugins { alias(libs.plugins.androidApplication) @@ -50,6 +51,10 @@ android { .toInt() versionCode = 1 versionName = "1.0.0-alpha01" + + // Crash-reporting DSN, kept out of the public repo: read from local.properties + // (glitchtip.dsn=...). Empty when absent, which disables the Sentry SDK. + manifestPlaceholders["glitchtipDsn"] = localProperty("glitchtip.dsn") ?: "" } packaging { resources { @@ -67,3 +72,12 @@ android { targetCompatibility = JavaVersion.VERSION_11 } } + +/** Reads a key from the root local.properties, or null when the file or key is absent. */ +fun localProperty(key: String): String? { + val file = rootProject.file("local.properties") + if (!file.exists()) return null + return Properties() + .apply { file.inputStream().use { load(it) } } + .getProperty(key) +} diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index e0da81a..5d94f36 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -21,7 +21,8 @@ - + +