9 changed files with 51 additions and 1 deletions
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
const dotenv = require("dotenv"); |
||||
const { readFileSync } = require("fs"); |
||||
|
||||
const parseEnvVariables = (filepath) => { |
||||
return Object.entries(dotenv.parse(readFileSync(filepath))).reduce( |
||||
(env, [key, value]) => { |
||||
env[key] = JSON.stringify(value); |
||||
return env; |
||||
}, |
||||
{}, |
||||
); |
||||
}; |
||||
|
||||
module.exports = { parseEnvVariables }; |
||||
Loading…
Reference in new issue