Skip to content

Commit

Permalink
fix(setup): do not show warnings if module is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjans committed Jul 25, 2024
1 parent c4c27bd commit a063808
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ export default defineNuxtModule<ModuleOptions>({
);

// Make sure url and key are set
if (!nuxt.options.runtimeConfig.public.posthog.publicKey) {
const enabled = !nuxt.options.runtimeConfig.public.posthog.disabled;
if (enabled && !nuxt.options.runtimeConfig.public.posthog.publicKey) {
console.warn('Missing PostHog API public key, set it either in `nuxt.config.ts` or via env variable');
}
if (!nuxt.options.runtimeConfig.public.posthog.host) {
if (enabled && !nuxt.options.runtimeConfig.public.posthog.host) {
console.warn('Missing PostHog API host, set it either in `nuxt.config.ts` or via env variable');
}

Expand Down

0 comments on commit a063808

Please sign in to comment.