{"id":"eggflaw/lune-dotenv","name":"lune-dotenv","scope":"eggflaw","platform":"roblox","description":"A dotenv parser for Lune","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"661885c1a70cd915478fce0e359a8f5bbbd051f7da523cce9651a463bab203d2","likes":0,"downloads":0,"install":"forest install eggflaw/lune-dotenv","url":"https://forest.dev/p/roblox/eggflaw/lune-dotenv","files":"https://api.forest.dev/ai/package/roblox/eggflaw/lune-dotenv/files","readme":"# lune-dotenv\nA dotenv parser for Lune\n\nlune-dotenv loads environtment variables from a `.env` file and adds them into `process.env`.\n> [!WARNING]\n> lune-dotenv is still in-development. Some features aren't implemented yet and there might be breaking changes to the API in the future.\n\n* [Installtation](#installation)\n* [Usage](#usage)\n* [API](#api)\n* [TODO](#todo)\n\n\n## Installation\n### Wally\nComing soon.\n\n### Git submodules\n```\ngit submodule add  https://github.com/Eggflaw/lune-dotenv.git\n```\n## Usage\nCreate a `.env` file into the root directory of your project.\n```env\nOPENCLOUD_KEY=OPENCLOUDKEYHERE\nSECRETS=\"SECRETS\"\n```\nYou can now load the `.env` file with lune-dotenv\n```lua\nlocal process = require(\"@lune/process\")\nlocal dotenv = require(\"Packages/lune-dotenv\") -- Assuming you added lune-dotenv into Packages/\n\ndotenv:load() -- Must come before accessing process.env\nprint(process.env.OPENCLOUD_KEY) -- Remove after you confirmed it's working\n\n```\n## API\n### `dotenv:load(overwrite: boolean?, path: string?)`\nLoads a `.env` file and add it into `process.env`\n\nBy default, `load` will find a `.env` file in the current working directory\n\nIf there is an environment variable with the same key name,  lune-dotenv will not overwrite it.\n<br>\nSet `overwrite` to true to avoid this.\n\n```lua\n\ndotenv:load(false)\nprint(process.env.HOME) -- \"/home/yourname\"\n\n--============--\n\ndotenv:load(true)\nprint(process.env.HOME) -- \"NEWHOME\"\n\n```\n\nYou can give `load` a custom path instead of finding a `.env` in the current directory\n```lua\ndotenv:load(false, \"tests/envs/path.env\")\nprint(process.env.CUSTOM_PATH)\n```\n\n### `dotenv:parse(str: string): { [string?]: string? }`\nParse `.env` content and convert it into a table. <br>\nUse this if you don't want to load `.env` into `process.env`\n\n```lua\nlocal content = fs.readFile(\".env\")\n\nlocal env = dotenv:parse(content)\nprint(env)\n```\n\n## TODO\n- [x] Basic values\n- [ ] Multiline values\n- [ ] Comments\n- [ ] Variable Substitution\n- [ ] Command Substitution\n- [ ] Exports\n\nReferences:\n- https://rubydoc.info/github/bkeepers/dotenv/main#multi-line-values\n- https://github.com/motdotla/dotenv?tab=readme-ov-file#%EF%B8%8F-usage\n","readmeTruncated":false}