1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Fixing an issue with env variables becoming numbers if they started with one.

This commit is contained in:
mike12345567 2021-10-11 17:59:44 +01:00
parent 582f9052d8
commit 7ae840f758
2 changed files with 12 additions and 3 deletions

View file

@ -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
}
}

View file

@ -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
}
}