From 3e42c291a8b7d377fb5e1c9ba11f5f0afb2cb2eb Mon Sep 17 00:00:00 2001 From: k-fish Date: Thu, 24 Jun 2021 11:36:43 -0400 Subject: [PATCH] ref(ember): Allow initing Ember without config entry Using the config is only necessary if you want to change specific addon options now, and the docs are going to be updated to reflect this. Passing a config object to should work without a config entry for sentry. --- packages/ember/addon/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ember/addon/index.ts b/packages/ember/addon/index.ts index 861093e70b6d..76248bf7a219 100644 --- a/packages/ember/addon/index.ts +++ b/packages/ember/addon/index.ts @@ -17,6 +17,11 @@ export function InitSentryForEmber(_runtimeConfig: BrowserOptions | undefined) { assert('Missing configuration.', config); assert('Missing configuration for Sentry.', config.sentry || _runtimeConfig); + if (!config.sentry) { + // If environment config is not specified but the above assertion passes, use runtime config. + config.sentry = { ..._runtimeConfig } as any; + } + // Permanently merge options into config, preferring runtime config Object.assign(config.sentry, _runtimeConfig || {}); const initConfig = Object.assign({}, config.sentry);