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

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented May 18, 2021

Summary

Runtime config initially was meant to act as an override, but moving forward we want to be able to support accepting the usual Sentry init config so that passing functions is possible and setup and configuration is easier. This PR will allow runtime options to accept Sentry config (addon config will still be handled by the environment config files) and merge it with priority into any existing environment config.

Refs #3562

Runtime config initially was meant to act as an override, but moving forward we want to be able to support it accepting the usual Sentry init config so that passing functions is possible.
@k-fish k-fish requested a review from kamilogorek as a code owner May 18, 2021 22:21
@github-actions
Copy link
Contributor

github-actions bot commented May 18, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.76 KB (0%)
@sentry/browser - Webpack 21.98 KB (0%)
@sentry/react - Webpack 22.01 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.16 KB (0%)

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.

@AbhiPrasad AbhiPrasad merged commit c7d9d83 into master May 19, 2021
@AbhiPrasad AbhiPrasad deleted the ref/ember-improve-runtime-config-option branch May 19, 2021 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants