Created
May 3, 2019 21:53
-
-
Save leobrines/069288b58df012b180bdb4ea8c037246 to your computer and use it in GitHub Desktop.
Enviroment configuration for NodeJS - "Twelve-Factor App" | https://12factor.net/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const enviroment = {}; | |
Object.assign(enviroment, process.env); | |
for (let [key, value] of Object.entries(enviroment)) { | |
switch (value) { | |
case "true": | |
enviroment[key] = true; | |
break; | |
case "false": | |
enviroment[key] = false; | |
break; | |
default: | |
if (Number(value)) | |
enviroment[key] = Number(value); | |
} | |
} | |
module.exports = enviroment; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment