{"id":32122089,"url":"https://github.com/janrabcan/deno-dotenv-file","last_synced_at":"2026-06-06T15:01:34.971Z","repository":{"id":62421614,"uuid":"288039457","full_name":"janrabcan/deno-dotenv-file","owner":"janrabcan","description":"A library for Deno parsing dotenv file into object-oriented structure","archived":false,"fork":false,"pushed_at":"2021-01-28T11:43:09.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-21T21:53:50.585Z","etag":null,"topics":["deno","envfile"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/janrabcan.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}},"created_at":"2020-08-16T23:09:34.000Z","updated_at":"2021-01-28T11:37:58.000Z","dependencies_parsed_at":"2022-11-01T17:45:31.193Z","dependency_job_id":null,"html_url":"https://github.com/janrabcan/deno-dotenv-file","commit_stats":null,"previous_names":["hellsos/deno-dotenv-file"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/janrabcan/deno-dotenv-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janrabcan%2Fdeno-dotenv-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janrabcan%2Fdeno-dotenv-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janrabcan%2Fdeno-dotenv-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janrabcan%2Fdeno-dotenv-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janrabcan","download_url":"https://codeload.github.com/janrabcan/deno-dotenv-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janrabcan%2Fdeno-dotenv-file/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33986901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"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":["deno","envfile"],"created_at":"2025-10-20T20:18:00.183Z","updated_at":"2026-06-06T15:01:34.912Z","avatar_url":"https://github.com/janrabcan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DotEnv File  [![Deno ci](https://github.com/Hellsos/deno-dotenv-file/workflows/CI/badge.svg)](https://github.com/Hellsos/deno-dotenv-file)\n\nA library for Deno parsing dotenv file into object-oriented structure making it more friendly for working in IDEs.\n\n## Usage\n\nSetup **.env** file.\n\n````\n# .env\n\nDebug = false\n\nMasterDatabase:host = 'host'\nMasterDatabase:port = 'port'\nMasterDatabase:password = 'secret'\n````\n\nDefine interface structure of **.env** file, load and print out the structure.\n\n````ts\n// app.ts\nimport { loadEnv } from \"https://deno.land/x/dotenvfile/mod.ts\";\n\ninterface IEnvStructure {\n\tDebug : boolean;\n\tMasterDatabase : {\n\t\thost: string;\n\t\tport: string;\n\t\tpassword: string;\n\t}\n}\n\nconst env = await loadEnv\u003cIEnvStructure\u003e();\n\nconsole.log( env ); // Printing parsed object from .env\nconsole.log('Host is:',  env.MasterDatabase.host ); // Printing MasterDatabase:host value\n\n````\n\nThen execute in your app. `deno run --allow-read=.env app.ts`.\n\n````\n{ \n    Debug: false, \n    MasterDatabase: { \n        host: \"host\", \n        port: \"port\", \n        password: \"secret\"\n    } \n}\n\nHost is: host\n````\n\n## Options\n\n- `envPath?: string`: Optional path to `.env` file. Default value is `.env`.\n- `envLockPath?: string|null`: Optional path to `.env.lock` file. Default value is `null`. If there is path defined, parser will determine whether `.env` has present keys defined in `.env.lock` and in case of missing ones will throw an error. \n- `errorOnDuplicateKey?: boolean`: Set to `false` will no longer throw an error when there is duplicity in `.env` variables. Default value is `true`.\n\n\n## Advanced Usage\n\n### .env.lock file\n\nUsing `.env.lock` file to define mandatory variables which has to be present in `.env` file.\n\nThis scenario is often used in situations, where you don't want to publish files which does contain credentials or any secret data into your repository but you still need to ensure that `.env` file has all variables it needs before starting your application.\n\nFor this situation there is `.env.lock` file which does not contain any secret or config data but variable names which must be set in `.env` file. In case of missing variable it will throw an error.\n\nSetup **.env** and **.env.lock** file.\n\n````\n# .env\n\nExample = 'Value'\n````\n````\n# .env.lock\n\nExample =\nMandatoryVariable =\nAnotherMandatoryVariable:nested =\n````\n\nDefine interface structure of **.env.lock** file, load and try to print out parsed structure.\n\n````ts\n// app.ts\nimport { loadEnv } from \"https://deno.land/x/dotenvfile/mod.ts\";\n\ninterface IEnvStructure {\n    Example : string;\n    MandatoryVariable : string;\n    AnotherMandatoryVariable : {\n        nested : string\n    };\n}\n\nconst env = await loadEnv\u003cIEnvStructure\u003e({\n    envLockPath: '.env.lock'\n});\n\nconsole.log( env );\n````\n\nThen execute in your app. `deno run --allow-read=.env,.env.lock app.ts`.\nIn this case it will lead to throwing an error because of missing variables `MandatoryVariable` and `AnotherMandatoryVariable:nested` defined in `.env.lock` file.\n\n````\nerror: Uncaught \nError: Missing [MandatoryVariable] in [.env]\nError: Missing [AnotherMandatoryVariable:nested] in [.env]\n````\n\n### Run tests\n \n`deno test --allow-read=examples`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanrabcan%2Fdeno-dotenv-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanrabcan%2Fdeno-dotenv-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanrabcan%2Fdeno-dotenv-file/lists"}