Skip to content

Commit

Permalink
fix: options.telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrtsky committed May 5, 2020
1 parent cf64c4e commit 1592144
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _module from '..'

export default {
modules: [_module],
'@nuxt/telemetry': {
telemetry: {
url: 'https://6v4qwm51s4.execute-api.us-east-1.amazonaws.com/dev/save'
}
}
1 change: 1 addition & 0 deletions lib/events-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class EventsStorage {
return {
status: 'rejected',
reason:
// TODO: implement NUXT_TELEMETRY_DEV_DEBUG for debug events
'Error in event processor, try NUXT_TELEMETRY_DEV_DEBUG for debug'
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ export default function telemetryModule(moduleOptions) {
}
const config = defu(
{
...this.options['@nuxt/telemetry'],
...this.options.telemetry,
...moduleOptions
},
defaultConfig
)

if (
this.options.telemetry === false ||
isTrue(process.env.NUXT_TELEMETRY_DISABLED) ||
isTrue(config.isDisabled)
) {
return
}

consola.warn('Telemetry is running')
consola.debug('Telemetry is running')

const t = new Telemetry(this.nuxt)

Expand Down
3 changes: 1 addition & 2 deletions lib/post-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function getUserAgent({ options }) {

export async function postEvent({ body }, { options }) {
const url =
(options['@nuxt/telemetry'] && options['@nuxt/telemetry'].url) ||
'http://localhost:8888/save'
(options.telemetry && options.telemetry.url) || 'http://localhost:8888/save'

if (isTrue(process.env.NUXT_TELEMETRY_DEBUG)) {
// Debug only
Expand Down

0 comments on commit 1592144

Please sign in to comment.