Skip to content

Commit 2d4035a

Browse files
committed
reaper: Require setting OVERRIDE_BASE_URL
1 parent 5ef6755 commit 2d4035a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

reaper/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to reaper will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
- Require `com.emergetools.OVERRIDE_BASE_URL` to be set. [#610](https://github.com/EmergeTools/emerge-android/pull/610)
11+
812
## 1.0.1 - 2025-03-05
913

1014
- Add `Reaper.fuseOff()`. [#491](https://github.com/EmergeTools/emerge-android/pull/491)

reaper/reaper/src/main/kotlin/com/emergetools/reaper/Manifest.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import android.os.Bundle
44

55
private const val MANIFEST_TAG_INSTRUMENTED = "com.emergetools.reaper.REAPER_INSTRUMENTED"
66
private const val MANIFEST_TAG_PUBLISHABLE_API_KEY = "com.emergetools.reaper.PUBLISHABLE_API_KEY"
7+
8+
// Override is a misnomer now as this is required and there is no base endpoint however
9+
// don't want to rename this and create more confusion.
710
private const val MANIFEST_TAG_OVERRIDE_BASE_URL = "com.emergetools.OVERRIDE_BASE_URL"
811
private const val MANIFEST_TAG_DEBUG = "com.emergetools.reaper.DEBUG"
912

@@ -16,7 +19,12 @@ internal fun getApiKey(metadata: Bundle): String {
1619
}
1720

1821
internal fun getBaseUrl(metadata: Bundle): String {
19-
return metadata.getString(MANIFEST_TAG_OVERRIDE_BASE_URL, ReaperConfig.EMERGE_BASE_URL)
22+
val baseUrl = metadata.getString(MANIFEST_TAG_OVERRIDE_BASE_URL, "")
23+
check(baseUrl != "") {
24+
"com.emergetools.OVERRIDE_BASE_URL must be set to a URL. " +
25+
"See https://docs.emergetools.com/docs/reaper-setup-android#setting-baseurl"
26+
}
27+
return baseUrl
2028
}
2129

2230
internal fun isDebug(metadata: Bundle): Boolean {

reaper/sample/app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
</activity>
2222
<activity android:name="androidx.activity.ComponentActivity" />
2323

24+
<!-- The Reaper library sends data to two endpoints:
25+
- $baseUrl/report
26+
- $baseUrl/reaper/error
27+
So if baseUrl is set to https://example.com/foo as
28+
below Reaper reports will be sent to:
29+
- https://example.com/foo/report
30+
and errors will be sent to:
31+
- https://example.com/foo/reaper/error
32+
-->
33+
<meta-data
34+
android:name="com.emergetools.OVERRIDE_BASE_URL"
35+
android:value="https://example.com/foo" />
36+
2437
</application>
2538

2639
</manifest>

reaper/sample/stress/src/main/AndroidManifest.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@
1313
<category android:name="android.intent.category.LAUNCHER" />
1414
</intent-filter>
1515
</activity>
16+
17+
<!-- The Reaper library sends data to two endpoints:
18+
- $baseUrl/report
19+
- $baseUrl/reaper/error
20+
So if baseUrl is set to https://example.com/foo as
21+
below Reaper reports will be sent to:
22+
- https://example.com/foo/report
23+
and errors will be sent to:
24+
- https://example.com/foo/reaper/error
25+
-->
26+
<meta-data
27+
android:name="com.emergetools.OVERRIDE_BASE_URL"
28+
android:value="https://example.com/foo" />
29+
1630
</application>
1731

1832
</manifest>

0 commit comments

Comments
 (0)