Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(ember): Fix merging of runtime config with environment config. #3563

Merged
merged 2 commits into from
May 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/ember/addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export function InitSentryForEmber(_runtimeConfig: BrowserOptions | undefined) {
assert('Missing configuration.', config);
assert('Missing configuration for Sentry.', config.sentry || _runtimeConfig);

const initConfig = Object.assign({}, config.sentry, _runtimeConfig || {});
// Permanently merge options into config, preferring runtime config
Object.assign(config.sentry, _runtimeConfig || {});
const initConfig = Object.assign({}, config.sentry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that initConfig does now, is shallow clone of config.sentry. And because the only thing you modify is an object (which is assigned by reference), it's effectively 2 objects with the same values (+ _metadata in case of initConfig). I wonder if it wouldn't be simpler to just go directly with config.sentry passed to Sentry.init instead. If you think not, just ignore the comment.


initConfig._metadata = initConfig._metadata || {};
initConfig._metadata.sdk = {
Expand Down