Skip to content

Commit bdf5562

Browse files
authored
Merge pull request #402 from Seluj78/262-env-check
check env variables before app boots
2 parents 11a183a + 4fa24db commit bdf5562

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

frontend/src/main.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,22 @@ Vue.config.productionTip = false;
1717
Vue.use(http);
1818
Vue.use(errorMessenger);
1919

20-
new Vue({
21-
router,
22-
store,
23-
render: (h) => h(App),
24-
}).$mount('#app');
20+
function envHasNecessaryVariables() {
21+
return !(!process.env.VUE_APP_BACKEND_BASE_URL
22+
|| !process.env.VUE_APP_ACCESS_TOKEN
23+
|| !process.env.VUE_APP_REFRESH_TOKEN
24+
|| !process.env.VUE_APP_VUEX_PERSISTED_STATE
25+
|| !process.env.VUE_APP_SECURE_LS_METADATA);
26+
}
27+
28+
if (envHasNecessaryVariables()) {
29+
new Vue({
30+
router,
31+
store,
32+
render: (h) => h(App),
33+
}).$mount('#app');
34+
} else {
35+
console.log('Environment variables missing. Please, set VUE_APP_BACKEND_BASE_URL,'
36+
+ 'VUE_APP_ACCESS_TOKEN, VUE_APP_REFRESH_TOKEN, VUE_APP_VUEX_PERSISTED_STATE,'
37+
+ 'VUE_APP_SECURE_LS_METADATA variables in .env file of frontend folder');
38+
}

0 commit comments

Comments
 (0)