UNPKG

probot

Version:

A framework for building GitHub Apps to automate and improve your workflow

16 lines (15 loc) 415 B
import { readFileSync } from "node:fs"; import { join as pathJoin } from "node:path"; import { parseEnv } from "node:util"; export function loadEnv(options = {}) { const { path = pathJoin(process.cwd(), ".env") } = options || {}; try { return parseEnv(readFileSync(path, "utf-8")); } catch (err) { if (err.code !== "ENOENT") { throw err; } } return {}; }