From 4ce73861285f2a4a25825adbcca4edb112e4f98c Mon Sep 17 00:00:00 2001
From: Kasper Seweryn <github@wvffle.net>
Date: Mon, 21 Feb 2022 23:23:13 +0100
Subject: [PATCH] Fix env variables

---
 front/src/App.vue                          | 2 +-
 front/src/components/Sidebar.vue           | 2 +-
 front/src/components/audio/EmbedWizard.vue | 2 +-
 front/src/registerServiceWorker.js         | 4 ++--
 front/src/store/instance.js                | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/front/src/App.vue b/front/src/App.vue
index 75f14710e2..6bf75fbf21 100644
--- a/front/src/App.vue
+++ b/front/src/App.vue
@@ -272,7 +272,7 @@ export default {
       // 3. use the current url
       const defaultInstanceUrl =
         this.$store.state.instance.frontSettings.defaultServerUrl ||
-        process.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']()
+        import.meta.env.VUE_APP_INSTANCE_URL || this.$store.getters['instance/defaultUrl']()
       this.$store.commit('instance/instanceUrl', defaultInstanceUrl)
     } else {
       // needed to trigger initialization of axios / service worker
diff --git a/front/src/components/Sidebar.vue b/front/src/components/Sidebar.vue
index 77abd0b8b7..7282fb15fe 100644
--- a/front/src/components/Sidebar.vue
+++ b/front/src/components/Sidebar.vue
@@ -590,7 +590,7 @@ export default {
       )
     },
     production () {
-      return process.env.NODE_ENV === 'production'
+      return import.meta.env.NODE_ENV === 'production'
     }
   },
   watch: {
diff --git a/front/src/components/audio/EmbedWizard.vue b/front/src/components/audio/EmbedWizard.vue
index 62abe05c9a..adcc3390fd 100644
--- a/front/src/components/audio/EmbedWizard.vue
+++ b/front/src/components/audio/EmbedWizard.vue
@@ -134,7 +134,7 @@ export default {
       return _.get(this.nodeinfo, 'metadata.library.anonymousCanListen', false)
     },
     iframeSrc () {
-      let base = process.env.BASE_URL
+      let base = import.meta.env.BASE_URL
       if (base.startsWith('/')) {
         // include hostname/protocol too so that the iframe link is absolute
         base = `${window.location.protocol}//${window.location.host}${base}`
diff --git a/front/src/registerServiceWorker.js b/front/src/registerServiceWorker.js
index aa5d66df7a..f403b09f12 100644
--- a/front/src/registerServiceWorker.js
+++ b/front/src/registerServiceWorker.js
@@ -4,8 +4,8 @@ import { register } from 'register-service-worker'
 
 import store from './store'
 
-if (process.env.NODE_ENV === 'production') {
-  register(`${process.env.BASE_URL}service-worker.js`, {
+if (import.meta.env.NODE_ENV === 'production') {
+  register(`${import.meta.env.BASE_URL}service-worker.js`, {
     registrationOptions: { scope: '/' },
     ready () {
       console.log(
diff --git a/front/src/store/instance.js b/front/src/store/instance.js
index ca3411b20c..74b5bb67ba 100644
--- a/front/src/store/instance.js
+++ b/front/src/store/instance.js
@@ -20,7 +20,7 @@ export default {
   state: {
     maxEvents: 200,
     frontSettings: {},
-    instanceUrl: process.env.VUE_APP_INSTANCE_URL,
+    instanceUrl: import.meta.env.VUE_APP_INSTANCE_URL,
     events: [],
     knownInstances: [],
     nodeinfo: null,
-- 
GitLab