Skip to content

Commit

Permalink
client and server config
Browse files Browse the repository at this point in the history
  • Loading branch information
aldarund committed Apr 17, 2019
1 parent 6df9827 commit d74ef0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -122,6 +122,18 @@ Normally setting required DSN information would be enough.
environment: this.options.dev ? 'development' : 'production'
}`

### serverConfig
- Type: `Object`
- Default: `{
}`
- If specified, values will override config values for server sentry plugin

### clientConfig
- Type: `Object`
- Default: `{
}`
- If specified, values will override config values for client sentry plugin

## Submitting releases to Sentry
Support for the [sentry-webpack-plugin](https://github.com/getsentry/sentry-webpack-plugin) was introduced [#a6cd8d3](https://github.com/nuxt-community/sentry-module/commit/a6cd8d3b983b4c6659e985736b19dc771fe7c9ea). This can be used to send releases to Sentry. Use the publishRelease option to enable this feature.

Expand Down
10 changes: 8 additions & 2 deletions lib/module.js
Expand Up @@ -37,6 +37,8 @@ module.exports = function sentry(moduleOptions) {
config: {
environment: this.options.dev ? 'development' : 'production'
},
serverConfig: {},
clientConfig: {},
webpackConfig: {
include: [],
ignore: [
Expand All @@ -50,6 +52,10 @@ module.exports = function sentry(moduleOptions) {

const topLevelOptions = this.options.sentry || {}
const options = deepMerge.all([defaults, topLevelOptions, moduleOptions])

options.serverConfig = deepMerge.all([options.config, options.serverConfig])
options.clientConfig = deepMerge.all([options.config, options.clientConfig])

if (!options.disableServerRelease) {
options.webpackConfig.include.push(`${buildDirRelative}/dist/server`)
}
Expand Down Expand Up @@ -80,7 +86,7 @@ module.exports = function sentry(moduleOptions) {
options: {
config: {
dsn: options.dsn,
...options.config
...options.clientConfig
},
initialize: options.initialize,
integrations: filterDisabledIntegration(options.clientIntegrations).
Expand All @@ -95,7 +101,7 @@ module.exports = function sentry(moduleOptions) {
if (options.initialize) {
Sentry.init({
dsn: options.dsn,
...options.config,
...options.serverConfig,
integrations: filterDisabledIntegration(options.serverIntegrations).
map(name => new Integrations[name](options.serverIntegrations[name]))
})
Expand Down

0 comments on commit d74ef0e

Please sign in to comment.