Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

✨ Updates parseAsEnvVar to read env vars for widget API keys

Alicia Sykes75f65de8f6a4
diff --git a/src/mixins/WidgetMixin.js b/src/mixins/WidgetMixin.js
index cf85300f..53019adf 100644
--- a/src/mixins/WidgetMixin.js
+++ b/src/mixins/WidgetMixin.js
@@ -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;
},
},