{"id":31195620,"url":"https://github.com/daar/dotenv","last_synced_at":"2026-02-16T17:03:42.007Z","repository":{"id":314860831,"uuid":"1057010422","full_name":"daar/dotenv","owner":"daar","description":"A lightweight `.env` file loader for Free Pascal","archived":false,"fork":false,"pushed_at":"2025-09-15T07:28:42.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-15T09:29:25.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-15T06:49:18.000Z","updated_at":"2025-09-15T07:28:12.000Z","dependencies_parsed_at":"2025-09-15T09:29:29.732Z","dependency_job_id":"3d53254b-aea3-4361-b772-ec1ea61e96eb","html_url":"https://github.com/daar/dotenv","commit_stats":null,"previous_names":["daar/dotenv"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/daar/dotenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daar%2Fdotenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daar%2Fdotenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daar%2Fdotenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daar%2Fdotenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daar","download_url":"https://codeload.github.com/daar/dotenv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daar%2Fdotenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276042107,"owners_count":25574998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-20T03:45:25.247Z","updated_at":"2025-09-20T03:45:29.094Z","avatar_url":"https://github.com/daar.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `Dotenv` Free Pascal .env Loader\n\nA lightweight `.env` file loader for **Free Pascal**. This library lets you load key/value pairs from a `.env` file into your Free Pascal program, with support for:\n\n- `KEY=VALUE` parsing\n- Single-quoted and double-quoted values\n- Escaped characters inside double quotes (`\\n`, `\\r`, `\\t`, `\\\\`, `\\\"`)\n- Variable expansion using `${VAR}`\n- Required variable checks\n\n\u003e ⚠️ Note: This implementation does **not** modify the system environment.  \n\u003e All variables are stored internally in memory and accessed via `DotEnvGet(Key)`.\n\n\n## Why?\n\nManaging configuration through environment variables is a best practice, especially for web or desktop applications.  \nInstead of hardcoding secrets or config values, you can keep them in a `.env` file and load them safely into your Pascal application. `.env` files can be excluded from your repository to keep sensitive data secure.\n\n\n## Installation\n\nIf you use [Nova Packager](https://github.com/daar/nova), add this package to your project:\n\n```bash\nnova require daar/dotenv\n````\n\nThen import it in your Pascal code:\n\n```pascal\nuses Dotenv;\n```\n\n\n\n## Usage\n\n### 1. Create a `.env` file\n\n```env\n# Database settings\nDB_HOST=localhost\nDB_USER=root\nDB_PASS=\"secret\"\n\n# Paths\nBASE_DIR=/home/user\nLOG_DIR=${BASE_DIR}/logs\n```\n\n\n\n### 2. Load the `.env` file in your Pascal code\n\n```pascal\nprogram DemoEnv;\n\nuses\n  SysUtils, Dotenv;\n\nbegin\n  // Load .env file)\n  LoadDotEnv('.env');\n\n  // Require some variables\n  RequireEnvVars(['DB_HOST', 'DB_USER', 'DB_PASS']);\n\n  // Print them\n  WriteLn('DB_HOST = ', DotEnvGet('DB_HOST'));\n  WriteLn('DB_USER = ', DotEnvGet('DB_USER'));\n  WriteLn('DB_PASS = ', DotEnvGet('DB_PASS'));\n  WriteLn('LOG_DIR = ', DotEnvGet('LOG_DIR'));\nend.\n```\n\nOutput:\n\n```\nDB_HOST = localhost\nDB_USER = root\nDB_PASS = secret\nLOG_DIR = /home/user/logs\n```\n\n\n\n### 3. Require specific variables\n\nEnsure that critical variables exist before running:\n\n```pascal\nRequireEnvVars(['DB_HOST', 'DB_USER', 'DB_PASS']);\n```\n\nIf any variable is missing, the program raises an exception:\n\n```\nRequired environment variable \"DB_PASS\" is not set!\n```\n\n\n\n## Features\n\n* ✅ Reads `.env` files line by line\n* ✅ Supports comments (`# ...`)\n* ✅ Handles quotes and escape sequences\n* ✅ Expands variables (`${VAR}`) using internal values\n* ✅ Provides `RequireEnvVars()` for safety checks\n* ✅ Fully self-contained — no system environment modification\n\n\n\n## License\n\nMIT — free to use and modify.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaar%2Fdotenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaar%2Fdotenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaar%2Fdotenv/lists"}