1
0
Fork 0

Make sentry APi key customisable

This commit is contained in:
James Turner 2020-05-12 12:01:59 +01:00
parent fec454def9
commit 620a02bad3
3 changed files with 12 additions and 3 deletions

View file

@ -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")

View file

@ -70,3 +70,4 @@
#cmakedefine ENABLE_SWIFT
#cmakedefine HAVE_SENTRY
#define SENTRY_API_KEY "@sentry_api_key@"

View file

@ -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);