Updates parseAsEnvVar to read env vars for widget API keys

This commit is contained in:
Alicia Sykes 2024-04-14 20:49:32 +01:00
parent 27a8c8fa56
commit 75f65de8f6

View File

@ -133,7 +133,15 @@ const WidgetMixin = {
},
/* Check if a value is an environment variable, return its value if so. */
parseAsEnvVar(str) {
if (str.includes('VUE_APP_')) return process.env[str];
if (typeof str !== 'string') return str;
if (str.includes('VUE_APP_')) {
const envVar = process.env[str];
if (!envVar) {
this.error(`Environment variable ${str} not found`);
} else {
return envVar;
}
}
return str;
},
},