Last active
April 8, 2020 20:59
-
-
Save blogui91/b7f9befd003afb44eeb3201e5884de3e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// config/envparser.js | |
const DotEnv = require('dotenv') | |
const parsedEnv = DotEnv.config().parsed | |
module.exports = function () { | |
// Let's stringify our variables | |
for (key in parsedEnv) { | |
if (typeof parsedEnv[key] === 'string') { | |
parsedEnv[key] = JSON.stringify(parsedEnv[key]) | |
} | |
} | |
return parsedEnv | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does it work w/o defining it first? (
const key in …
) didn't try because eslint was throwing error for that