mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
19 lines
457 B
JavaScript
19 lines
457 B
JavaScript
const dotenv = require("dotenv");
|
|
const { readFileSync } = require("fs");
|
|
const pkg = require("./package.json");
|
|
const parseEnvVariables = (filepath) => {
|
|
const envVars = Object.entries(dotenv.parse(readFileSync(filepath))).reduce(
|
|
(env, [key, value]) => {
|
|
env[key] = value;
|
|
return env;
|
|
},
|
|
{},
|
|
);
|
|
|
|
envVars.PKG_NAME = pkg.name;
|
|
envVars.PKG_VERSION = pkg.version;
|
|
|
|
return envVars;
|
|
};
|
|
|
|
module.exports = { parseEnvVariables };
|