diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cf6a1790..1a9fe9850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,9 +316,14 @@ find_package(OpenSceneGraph 3.2.0 REQUIRED find_package(sentry QUIET) +set(sentry_api_key $ENV{FLIGHTGEAR_SENTRY_API_KEY}) if (TARGET sentry::sentry) - message(STATUS "Sentry.io crash reporting enabled") - set(HAVE_SENTRY 1) + if (NOT sentry_api_key) + message(STATUS "Sentry.io crash reporting detected, but FLIGHTGEAR_SENTRY_API_KEY not set") + else() + message(STATUS "Sentry.io crash reporting enabled") + set(HAVE_SENTRY 1) + endif() endif() #if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index 8d67682e1..0edfd2e15 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -70,3 +70,4 @@ #cmakedefine ENABLE_SWIFT #cmakedefine HAVE_SENTRY +#define SENTRY_API_KEY "@sentry_api_key@" diff --git a/src/Main/sentryIntegration.cxx b/src/Main/sentryIntegration.cxx index e116a2a79..e2fcc03e8 100644 --- a/src/Main/sentryIntegration.cxx +++ b/src/Main/sentryIntegration.cxx @@ -40,7 +40,10 @@ namespace flightgear void initSentry() { sentry_options_t *options = sentry_options_new(); - sentry_options_set_dsn(options, "https://3a3f0bf24d5d482388dd060860c18ffe@sentry.io/5188535"); + // API key is defined in config.h, set in an environment variable prior + // to running CMake, so it can be customised. Env var at build time is: + // FLIGHTGEAR_SENTRY_API_KEY + sentry_options_set_dsn(options, SENTRY_API_KEY); if (strcmp(FG_BUILD_TYPE, "Dev") == 0) { sentry_options_set_release(options, "flightgear-dev@" FLIGHTGEAR_VERSION);