Skip to content

Commit

Permalink
Merge pull request #27 from decktools/egnor/configure_sentry
Browse files Browse the repository at this point in the history
Merge user parameters with skeleton in `configure_sentry`
  • Loading branch information
jcpsantiago authored Aug 17, 2023
2 parents 654d4ce + b05048b commit e63aa28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions R/core.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,17 @@ configure_sentry <- function(dsn, app_name = NULL, app_version = NULL,

dsn_vars <- parse_dsn(dsn)

user_vars <- list(
skeleton <- list(
environment = environment,
contexts = list(
app = list(
app_name = app_name,
app_version = app_version
)
),
...
)
)

.sentry_env$payload_skeleton <- user_vars
.sentry_env$payload_skeleton <- utils::modifyList(skeleton, list(...))

invisible(list2env(dsn_vars, .sentry_env))
}
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-sentry.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ test_that("setting configuration works", {

configure_sentry(dsn = "https://[email protected]/1",
app_name = "el appo", app_version = "8.8.8",
environment = "production")
environment = "production",
contexts = list(app = list(app_identifier = "APPO")))

expect_equal(.sentry_env$payload_skeleton$contexts$app$app_name, "el appo")
expect_equal(.sentry_env$payload_skeleton$contexts$app$app_version, "8.8.8")
expect_equal(.sentry_env$payload_skeleton$contexts$app$app_identifier, "APPO")
expect_equal(.sentry_env$payload_skeleton$environment, "production")
expect_equal(.sentry_env$dsn, "https://[email protected]/1")
expect_equal(.sentry_env$protocol, "https")
Expand Down

0 comments on commit e63aa28

Please sign in to comment.