import { readFileSync } from 'fs'; import { createLogger } from '@/log'; const log = createLogger(); export default (path = '.env'): void => { const data = readFileSync(path); data .toString() .split('\n') .map((line) => /(\S*)=(.*)$/.exec(line)) .filter((value: T | null): value is T => value !== null) .forEach(([, key, value]) => { log.debug(`${key} = ${value}`); process.env[key] = value; }); };