From 75f65de8f6a47c1e8361992fc2e26b190f0e62ec Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 14 Apr 2024 20:49:32 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Updates=20parseAsEnvVar=20to=20read?= =?UTF-8?q?=20env=20vars=20for=20widget=20API=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/WidgetMixin.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; }, },