diff --git a/client/config/prod-my-kv.env.js b/client/config/prod-my-kv.env.js new file mode 100644 index 00000000..acdee143 --- /dev/null +++ b/client/config/prod-my-kv.env.js @@ -0,0 +1,17 @@ +'use strict' +module.exports = { + /* + * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes + * around strings + */ + VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, + + /* + * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes + */ + // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv + VUE_APP_FAVICON_32: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-fav.png', + VUE_APP_FAVICON_16: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-fav.png', + VUE_APP_TITLE: 'My KV' + // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ +} diff --git a/client/config/prod.env.js b/client/config/prod.env.js index af7e0a0b..9dcddc36 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -1,25 +1,34 @@ 'use strict' -module.exports = { +const { merge } = require('webpack-merge') + +const values = { NODE_ENV: '"production"', HEP_URL: JSON.stringify(process.env.HEP_URL), MATOMO_HOST: JSON.stringify(process.env.MATOMO_HOST), MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID), LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL), + VUE_APP_FLAVOR: JSON.stringify(process.env.APP_FLAVOR), /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes - * around strings + * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, + * and JS needs quotes around strings + * see https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code */ - VUE_APP_LOGO: JSON.stringify(process.env.VUE_APP_LOGO) || '"/static/logo.png"', - VUE_APP_ENABLE_PORTFOLIO: process.env.ENABLE_PORTFOLIO || "true", VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, - VUE_APP_JS_TITLE: JSON.stringify(process.env.VUE_APP_TITLE) || '"mySkillbox"', - VUE_APP_ENABLE_FOOTER: process.env.ENABLE_FOOTER || "true", + /* * Vars used in HTML templates don't need to be stringyfied, as HTML does not need them to have quotes */ // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv - VUE_APP_FAVICON_32: process.env.VUE_APP_FAVICON_32 || '/static/favicon-32x32.png', - VUE_APP_FAVICON_16: process.env.VUE_APP_FAVICON_16 || '/static/favicon-16x16.png', - VUE_APP_TITLE: process.env.VUE_APP_TITLE || 'mySkillbox' + VUE_APP_FAVICON_32: '/static/favicon-32x32.png', + VUE_APP_FAVICON_16: '/static/favicon-16x16.png', + VUE_APP_TITLE: 'mySkillbox' // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ } + +if (process.env.APP_FLAVOR === 'my-kv') { + module.exports = merge(values, require('./prod-my-kv.env.js')); +} else { + // we are on the skillbox APP_FLAVOR + module.exports = values; +} + diff --git a/client/src/components/AssignmentWithSubmissions.vue b/client/src/components/AssignmentWithSubmissions.vue index f27a9181..a335a799 100644 --- a/client/src/components/AssignmentWithSubmissions.vue +++ b/client/src/components/AssignmentWithSubmissions.vue @@ -9,7 +9,7 @@ Aufgabe im Modul anzeigen + >Aufgabe im {{ $flavor.textModule }} anzeigen