Browse Source
Merge pull request #2970 from Budibase/fix/env-vars
Fix env variable parsing
gh-pages
Michael Drury
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
3 deletions
-
packages/server/src/environment.js
-
packages/worker/src/environment.js
|
|
|
@ -74,9 +74,10 @@ module.exports = { |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
// convert any strings to numbers if required, like "0" would be true otherwise
|
|
|
|
// clean up any environment variable edge cases
|
|
|
|
for (let [key, value] of Object.entries(module.exports)) { |
|
|
|
if (typeof value === "string" && !isNaN(parseInt(value))) { |
|
|
|
module.exports[key] = parseInt(value) |
|
|
|
// handle the edge case of "0" to disable an environment variable
|
|
|
|
if (value === "0") { |
|
|
|
module.exports[key] = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -52,3 +52,11 @@ module.exports = { |
|
|
|
return !isDev() |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
// clean up any environment variable edge cases
|
|
|
|
for (let [key, value] of Object.entries(module.exports)) { |
|
|
|
// handle the edge case of "0" to disable an environment variable
|
|
|
|
if (value === "0") { |
|
|
|
module.exports[key] = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|