export default async () => { const file = Bun.file(`.env`); if ((await file.exists())) { const text = await file.text(); const lines = text.split("\n"); for (const line of lines) { // Ignore comments and empty lines if (!line || line.trim().startsWith("#")) continue; // Match key=value pairs const match = line.match(/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/); if (match) { const key = match[1]; let value = match[2] || ""; // Strip surrounding quotes if they exist value = value.replace(/^(['"])(.*)\1$/, "$2").trim(); // Update the environment variable process.env[key] = value; } } }; console.log(`.env reloaded`); }