mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-23 17:03:59 +03:00
✨ Updates parseAsEnvVar to read env vars for widget API keys
This commit is contained in:
parent
27a8c8fa56
commit
75f65de8f6
@ -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;
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user