Merge pull request #8813 from Budibase/env-var-fix

Environment variable type coercion fix
This commit is contained in:
Rory Powell 2022-11-25 13:30:00 +00:00 committed by GitHub
commit f8dfc32103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,8 @@ const env = {
ENCRYPTED_TEST_PUBLIC_API_KEY: process.env.ENCRYPTED_TEST_PUBLIC_API_KEY, ENCRYPTED_TEST_PUBLIC_API_KEY: process.env.ENCRYPTED_TEST_PUBLIC_API_KEY,
_set(key: any, value: any) { _set(key: any, value: any) {
process.env[key] = value process.env[key] = value
module.exports[key] = value // @ts-ignore
env[key] = value
}, },
isDev, isDev,
isTest, isTest,
@ -82,7 +83,7 @@ if (!env.APPS_URL) {
} }
// clean up any environment variable edge cases // clean up any environment variable edge cases
for (let [key, value] of Object.entries(module.exports)) { for (let [key, value] of Object.entries(env)) {
// handle the edge case of "0" to disable an environment variable // handle the edge case of "0" to disable an environment variable
if (value === "0") { if (value === "0") {
// @ts-ignore // @ts-ignore