Skip to content

Commit

Permalink
feat: use runtime config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Feb 22, 2021
1 parent e84d4c1 commit 444da40
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
20 changes: 13 additions & 7 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
const isDevEnv = process.env.NODE_ENV === 'development'

export default {
target: 'static',
ssr: false,

modern: isDevEnv ? undefined : 'client',
ssr: false,

// Generate 404 page for hosts
generate: { fallback: true },

/*
** Headers of the page
*/
publicRuntimeConfig: {
NODE_ENV: process.env.NODE_ENV,

API_URL: process.env.API_URL,

MATOMO_HOST: process.env.MATOMO_HOST,
MATOMO_SITE_ID: process.env.MATOMO_SITE_ID,
},

head: {
titleTemplate: (titleChunk) =>
titleChunk ? `${titleChunk} | Rule 34 App` : 'Rule 34 App',
Expand All @@ -30,7 +36,7 @@ export default {
},
{
name: 'monetization',
content: process.env.MONETIZATION_URI || '',
content: process.env.MONETIZATION_URI,
},
],

Expand Down Expand Up @@ -139,11 +145,11 @@ export default {
** Sentry.io
*/
sentry: {
dsn: process.env.SENTRY_DSN || '',
dsn: process.env.SENTRY_DSN,

lazy: true,

disabled: isDevEnv,
disabled: process.env.SENTRY_ENABLED,
disableClientSide: false,
disableServerSide: true,

Expand Down
15 changes: 9 additions & 6 deletions plugins/vue-matomo.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import Vue from 'vue'
import VueMatomo from 'vue-matomo'

export default ({ app }) => {
export default (context) => {
const { app, $config } = context

Vue.use(VueMatomo, {
host: 'https://matomo.akbal.dev',
siteId: 1,
host: $config.MATOMO_HOST,

siteId: $config.MATOMO_SITE_ID,

// trackerUrl: 'https://matomo.akbal.dev/m',
// trackerUrl: '',

// trackerScriptUrl: 'https://matomo.akbal.dev/m.js',
// trackerScriptUrl: '',

router: app.router,

Expand All @@ -17,7 +20,7 @@ export default ({ app }) => {
enableHeartBeatTimer: true,
heartBeatTimerInterval: 30,

debug: process.env.NODE_ENV === 'development',
debug: $config.NODE_ENV === 'development',

// preInitActions: [],
})
Expand Down

0 comments on commit 444da40

Please sign in to comment.